16341 27

[回归分析求助] Oprobit模型求边际效应问题 [推广有奖]

  • 1关注
  • 1粉丝

本科生

70%

还不是VIP/贵宾

-

威望
0
论坛币
177 个
通用积分
12.0006
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
265 点
帖子
28
精华
0
在线时间
189 小时
注册时间
2016-6-22
最后登录
2020-4-23

20论坛币
xi:oprobit happiness i.housenum sex age c.age#c.age dangyuan eduyear hukou marry1 zjxy ///
lnincome zfmj urban_pop1 dqgdpdex houprice finance_worker,robust nolog
得出的结果如下: I%)YZ2QXKRLGGA%Q(M90OYR.png
随后想求出边际效应
使用命令:
mfx compute,predict(outcome(1))
mfx compute,predict(outcome(2))
mfx compute,predict(outcome(3))
mfx compute,predict(outcome(4))
mfx compute,predict(outcome(5))

或者是使用升级版的命令:
mfx2

显示的结果都是:
c:  operator invalid
r(198);

2XXFSR(V3816{Z9V{1V8PVO.png
想请问各位是什么问题呢。



关键词:oprobit模型 oprobit Probit 边际效应 bit oprobit模型 边际效应 mfx

回帖推荐

蓝色 发表于7楼  查看完整内容

蓝色 发表于6楼  查看完整内容

你命令的最前面不是有 xi: 不要用那个 边际影响用margins命令
谢谢各位,不胜感激

使用道具

藤椅
蓝色 发表于 2019-1-7 22:22:32 |只看作者 |坛友微信交流群
都试了,没有问题

使用道具

板凳
蓝色 发表于 2019-1-7 22:28:14 |只看作者 |坛友微信交流群
一、不用xi
二、用margins命令
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
谢尚自能鸲鹆舞3 + 1 + 1 + 1 热心帮助其他会员

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

使用道具

蓝色 发表于 2019-1-7 22:28
一、不用xi
二、用margins命令
非常感谢老师那么晚还为我答疑解惑。老师运行的这个程序是没有问题,我运行自己之前用过的一个数据也没有任何问题,用的是同一款stata。但是运行该数据时就一直提示C:operator  invalid .不知道是什么原因。老师说的不用xi 是什么意思呢。

使用道具

地板
蓝色 发表于 2019-1-9 08:32:38 |只看作者 |坛友微信交流群
谢尚自能鸲鹆舞3 发表于 2019-1-8 21:10
非常感谢老师那么晚还为我答疑解惑。老师运行的这个程序是没有问题,我运行自己之前用过的一个数据也没有 ...
你命令的最前面不是有 xi:
不要用那个

边际影响用margins命令
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
谢尚自能鸲鹆舞3 + 1 + 1 + 1 精彩帖子

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

使用道具

7
蓝色 发表于 2019-1-9 08:35:59 |只看作者 |坛友微信交流群
  1. sysuse auto

  2. oprobit rep78 i.foreign c.length#c.mpg

  3. margins, dydx(*) predict(outcome(1))
  4. margins, dydx(*) predict(outcome(2))
  5. margins, dydx(*) predict(outcome(3))
复制代码

  1. . sysuse auto
  2. (1978 Automobile Data)

  3. .
  4. . oprobit rep78 i.foreign c.length#c.mpg

  5. Iteration 0:   log likelihood = -93.692061  
  6. Iteration 1:   log likelihood = -77.461544  
  7. Iteration 2:   log likelihood =  -77.28925  
  8. Iteration 3:   log likelihood = -77.288592  
  9. Iteration 4:   log likelihood = -77.288592  

  10. Ordered probit regression                       Number of obs     =         69
  11.                                                 LR chi2(2)        =      32.81
  12.                                                 Prob > chi2       =     0.0000
  13. Log likelihood = -77.288592                     Pseudo R2         =     0.1751

  14. --------------------------------------------------------------------------------
  15.          rep78 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
  16. ---------------+----------------------------------------------------------------
  17.        foreign |
  18.       Foreign  |   1.636001   .3394216     4.82   0.000     .9707469    2.301255
  19.                |
  20. c.length#c.mpg |   .0003867   .0002126     1.82   0.069    -.0000301    .0008034
  21. ---------------+----------------------------------------------------------------
  22.          /cut1 |  -.2824214   .8617441                     -1.971409    1.406566
  23.          /cut2 |    .618567   .8186588                     -.9859748    2.223109
  24.          /cut3 |     2.1905   .8289053                      .5658754    3.815125
  25.          /cut4 |   3.382743   .8938475                      1.630834    5.134652
  26. --------------------------------------------------------------------------------

  27. .
  28. . margins, dydx(*) predict(outcome(1))

  29. Average marginal effects                        Number of obs     =         69
  30. Model VCE    : OIM

  31. Expression   : Pr(rep78==1), predict(outcome(1))
  32. dy/dx w.r.t. : 1.foreign length mpg

  33. ------------------------------------------------------------------------------
  34.              |            Delta-method
  35.              |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
  36. -------------+----------------------------------------------------------------
  37.      foreign |
  38.     Foreign  |  -.0409779   .0272467    -1.50   0.133    -.0943804    .0124246
  39.       length |  -.0004468   .0003488    -1.28   0.200    -.0011305    .0002369
  40.          mpg |  -.0049881   .0040144    -1.24   0.214    -.0128561      .00288
  41. ------------------------------------------------------------------------------
  42. Note: dy/dx for factor levels is the discrete change from the base level.

  43. . margins, dydx(*) predict(outcome(2))

  44. Average marginal effects                        Number of obs     =         69
  45. Model VCE    : OIM

  46. Expression   : Pr(rep78==2), predict(outcome(2))
  47. dy/dx w.r.t. : 1.foreign length mpg

  48. ------------------------------------------------------------------------------
  49.              |            Delta-method
  50.              |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
  51. -------------+----------------------------------------------------------------
  52.      foreign |
  53.     Foreign  |  -.1470625   .0476436    -3.09   0.002    -.2404421   -.0536828
  54.       length |  -.0009963   .0005657    -1.76   0.078    -.0021051    .0001124
  55.          mpg |  -.0102563   .0059584    -1.72   0.085    -.0219346    .0014219
  56. ------------------------------------------------------------------------------
  57. Note: dy/dx for factor levels is the discrete change from the base level.

  58. . margins, dydx(*) predict(outcome(3))

  59. Average marginal effects                        Number of obs     =         69
  60. Model VCE    : OIM

  61. Expression   : Pr(rep78==3), predict(outcome(3))
  62. dy/dx w.r.t. : 1.foreign length mpg

  63. ------------------------------------------------------------------------------
  64.              |            Delta-method
  65.              |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
  66. -------------+----------------------------------------------------------------
  67.      foreign |
  68.     Foreign  |  -.3787057   .0934995    -4.05   0.000    -.5619614   -.1954499
  69.       length |  -.0008299   .0006064    -1.37   0.171    -.0020185    .0003587
  70.          mpg |  -.0052135    .004581    -1.14   0.255     -.014192     .003765
  71. ------------------------------------------------------------------------------
  72. Note: dy/dx for factor levels is the discrete change from the base level.
复制代码


使用道具

蓝色 发表于 2019-1-9 08:32
你命令的最前面不是有 xi:
不要用那个
老师好,尝试了您说的用margins

. do "D:\Stata14\STD04000000.tmp"

. oprobit happiness i.housenum sex age c.age#c.age dangyuan eduyear hukou marry1 zjxy ///
> lnincome zfmj urban_pop1 dqgdpdex houprice finance_worker,robust nolog

Ordered probit regression                       Number of obs     =      4,086
                                                Wald chi2(16)     =     303.90
                                                Prob > chi2       =     0.0000
Log pseudolikelihood =  -4389.563               Pseudo R2         =     0.0346

------------------------------------------------------------------------------
             |               Robust
   happiness |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    housenum |
   有一套房  |   .3883352   .0614187     6.32   0.000     .2679567    .5087136
     多套房  |   .6272601   .0734501     8.54   0.000     .4833006    .7712196
             |
         sex |  -.1278365   .0361398    -3.54   0.000    -.1986692   -.0570039
         age |   -.082792   .0138948    -5.96   0.000    -.1100252   -.0555587
             |
c.age#c.age |   .0008873   .0001625     5.46   0.000     .0005689    .0012057
             |
    dangyuan |   .0589298    .056098     1.05   0.293    -.0510203    .1688798
     eduyear |   .0337274   .0050082     6.73   0.000     .0239115    .0435433
       hukou |  -.0078488   .0375733    -0.21   0.835    -.0814911    .0657935
      marry1 |   .4281599   .0638562     6.71   0.000      .303004    .5533158
        zjxy |   .1269487   .0608625     2.09   0.037     .0076603     .246237
    lnincome |   .0116192   .0051171     2.27   0.023     .0015899    .0216485
        zfmj |   .0010055   .0002676     3.76   0.000     .0004811      .00153
  urban_pop1 |  -1.559975   .3523334    -4.43   0.000    -2.250536   -.8694147
    dqgdpdex |   .0039186   .0048791     0.80   0.422    -.0056442    .0134814
    houprice |  -.2947213    .095229    -3.09   0.002    -.4813668   -.1080758
finance_wo~r |   .0268949   .0070489     3.82   0.000     .0130793    .0407104
-------------+----------------------------------------------------------------
       /cut1 |  -2.472257    .776837                      -3.99483   -.9496846
       /cut2 |  -1.566008   .7726679                     -3.080409   -.0516064
       /cut3 |  -.7858455   .7728116                     -2.300528    .7288374
       /cut4 |   .9925541   .7733049                     -.5230957    2.508204
------------------------------------------------------------------------------

.
end of do-file

.
.
.
. do "D:\Stata14\STD04000000.tmp"

. margins,dydx(*), predict(outcome(1))
invalid 'predict'
r(198);

end of do-file

r(198);

最后显示 无效的predict 无效 不明白是什么意思

使用道具

9
蓝色 发表于 2019-1-9 16:24:23 |只看作者 |坛友微信交流群
谢尚自能鸲鹆舞3 发表于 2019-1-9 14:18
老师好,尝试了您说的用margins

. do "D:\Stata14\STD04000000.tmp"
看清楚我写的

使用道具

蓝色 发表于 2019-1-9 16:24
看清楚我写的
好的。非常感谢老师。为我的不仔细感到抱歉。

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-25 22:01