具有虚拟交互的多项Logit模型中的边际效应

时间:2014-08-16 19:32:28

标签: stata binary-data logistic-regression multinomial

我有一个包含交互项的二元变量的多项模型。当我将回归运行为:

mlogit x y x#y,我得到了合理的输出,其值为(0 1)的交互项的估计值,以及(1 0)和(1 1)的两个省略,正如我所期望的那样。但是,当我尝试运行命令mfx时,会返回错误:x#0b: operator invalid r(198)

当我预先生成交互术语时,z = x * y并运行mlogit x y z,我可以从模型中获得边际效果。但是,y和z(但不是x)的参数估计值与前一个规范相差很大,y与零显着不同(这是不可预期的)。

据我所知,这似乎是Stata 11处理交互术语的一个问题。如果我运行version 10.1: mlogit x y x#y,则会收到错误interactions not allowed r(101)

有没有办法可以mfx使用版本11生成的模型,或者我可以使用边际效果以外的其他东西来解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

您报告了我用示例覆盖的三个问题。代码中的注释解释。

clear all
set more off

webuse sysdsn1

*----- problem 1 -----

// error: -mfx- can't handle factor variable notation (use -margins- instead)
mlogit insure age male nonwhite male#nonwhite i.site
mfx

*----- problem 2 -----

// error: factor variable notation is available only with Stata >= 11
version 10: mlogit insure age male nonwhite male#nonwhite i.site

*----- problem 3 -----

// results are the same
mlogit insure age male nonwhite c.male#c.nonwhite i.site

gen mnw = male * nonwhite 
mlogit insure age male nonwhite mnw i.site

底线:

如果您有Stata> = 11,则可使用因子变量表示法(#) 建议的做法是使用margins,而不是mfx

如果你有Stata< 11您必须创建自己的互动,并且可以使用mfx

最后,如果您没有提供重现问题的实际代码(问题3),则无法正确评估不一致结果的陈述。

相关问题