我正在运行以下代码:
oprobit var1 var2 var3 var4 var5 var2##var3 var4##var5 var6 var7 etc.
如果没有交互术语,我可以使用以下代码来解释系数:
mfx compute, predict(outcome(2))
[结果相当于2(总共有4个结果)]
但由于mfx
无法使用交互术语,因此出现错误。
我试着用
margins
命令,但它也不起作用!
margins var2 var3 var4 var5 var2##var3 var4##var5 var6 var7 etc... , post
margins
仅适用于互动条款:(margins var2 var3 var4 var5, post)
我用什么命令来解释BOTH交互和常规变量?
最后,要使用简单的语言,我的问题是:给定上面的回归模型,我可以用什么命令来解释系数?
答案 0 :(得分:3)
mfx是一个旧的命令,已被边距替换。这就是为什么它不能用于定义交互的因子变量表示法。我不清楚你实际上打算用marginins命令计算什么。
以下是如何获得结果概率2的平均边际效应的示例:
. webuse fullauto
(Automobile Models)
. oprobit rep77 i.foreign c.weight c.length##c.mpg
Iteration 0: log likelihood = -89.895098
Iteration 1: log likelihood = -76.800575
Iteration 2: log likelihood = -76.709641
Iteration 3: log likelihood = -76.709553
Iteration 4: log likelihood = -76.709553
Ordered probit regression Number of obs = 66
LR chi2(5) = 26.37
Prob > chi2 = 0.0001
Log likelihood = -76.709553 Pseudo R2 = 0.1467
--------------------------------------------------------------------------------
rep77 | Coef. Std. Err. z P>|z| [95% Conf. Interval]
---------------+----------------------------------------------------------------
1.foreign | 1.514739 .4497962 3.37 0.001 .633155 2.396324
weight | -.0005104 .0005861 -0.87 0.384 -.0016593 .0006384
length | .0969601 .0348506 2.78 0.005 .0286542 .165266
mpg | .4747249 .2241349 2.12 0.034 .0354286 .9140211
|
c.length#c.mpg | -.0020602 .0013145 -1.57 0.117 -.0046366 .0005161
---------------+----------------------------------------------------------------
/cut1 | 17.21885 5.386033 6.662419 27.77528
/cut2 | 18.29469 5.416843 7.677877 28.91151
/cut3 | 19.66512 5.463523 8.956814 30.37343
/cut4 | 21.12134 5.515901 10.31038 31.93231
--------------------------------------------------------------------------------
. margins, dydx(*) predict(outcome(2))
Average marginal effects Number of obs = 66
Model VCE : OIM
Expression : Pr(rep77==2), predict(outcome(2))
dy/dx w.r.t. : 1.foreign weight length mpg
------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
1.foreign | -.2002434 .0576487 -3.47 0.001 -.3132327 -.087254
weight | .0000828 .0000961 0.86 0.389 -.0001055 .0002711
length | -.0088956 .003643 -2.44 0.015 -.0160356 -.0017555
mpg | -.012849 .0085546 -1.50 0.133 -.0296157 .0039178
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.
如果您想要预测而不是边际效应,请尝试
margins, predict(outcome(2))
在非线性模型中,仅仅相互作用项的边际效应更难计算。详情here。
答案 1 :(得分:0)
The marginal effects for positive outcomes, Pr(depvar1=1, depvar2=1), are
. mfx compute, predict(p11)
The marginal effects for Pr(depvar1=1, depvar2=0) are
. mfx compute, predict(p10)
The marginal effects for Pr(depvar1=0, depvar2=1) are
. mfx compute, predict(p01)