楼主: 拂去尘缘
5517 12

[回归分析求助] 固定效应求偏效应出现的问题 [推广有奖]

  • 0关注
  • 3粉丝

已卖:492份资源

副教授

65%

还不是VIP/贵宾

-

威望
0
论坛币
8949 个
通用积分
78.4484
学术水平
1 点
热心指数
2 点
信用等级
1 点
经验
14147 点
帖子
387
精华
0
在线时间
1213 小时
注册时间
2016-4-16
最后登录
2025-12-23

楼主
拂去尘缘 发表于 2017-3-4 22:49:18 |AI写论文
10论坛币
使用固定效应模型求解偏效应时出现了这样的问题
xtreg y x1 x2 x3 c.x1#c.x2 c.x1#c.x3 c.x2#c.x3, fe
margins, dydx(x1)
default prediction is a function of possibly stochastic quantities other than e(b)


关键词:固定效应 Quantities Prediction Stochastic Stochast

沙发
legendlee2225 发表于 2017-3-4 22:55:49
友情帮顶,虽然不懂

藤椅
拂去尘缘 发表于 2017-3-4 22:59:40
legendlee2225 发表于 2017-3-4 22:55
友情帮顶,虽然不懂
非常感谢您

板凳
蓝色 发表于 2017-3-5 09:11:32

没有问题啊
是你数据问题
或者stata没有升级的原因吧


  1. . webuse nlswork,clear
  2. (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)

  3. . xtset idcode
  4.        panel variable:  idcode (unbalanced)

  5. . xtreg ln_w tenure age c.age#c.tenure,fe

  6. Fixed-effects (within) regression               Number of obs      =     28101
  7. Group variable: idcode                          Number of groups   =      4699

  8. R-sq:  within  = 0.1370                         Obs per group: min =         1
  9.        between = 0.2032                                        avg =       6.0
  10.        overall = 0.1569                                        max =        15

  11.                                                 F(3,23399)         =   1238.67
  12. corr(u_i, Xb)  = 0.1379                         Prob > F           =    0.0000

  13. --------------------------------------------------------------------------------
  14.        ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
  15. ---------------+----------------------------------------------------------------
  16.         tenure |   .0733305   .0037696    19.45   0.000     .0659418    .0807192
  17.            age |   .0147157   .0004481    32.84   0.000     .0138373    .0155941
  18.                |
  19. c.age#c.tenure |  -.0014554   .0001027   -14.17   0.000    -.0016567    -.001254
  20.                |
  21.          _cons |   1.168467   .0125738    92.93   0.000     1.143822    1.193112
  22. ---------------+----------------------------------------------------------------
  23.        sigma_u |  .38792641
  24.        sigma_e |   .2968178
  25.            rho |  .63074038   (fraction of variance due to u_i)
  26. --------------------------------------------------------------------------------
  27. F test that all u_i=0:     F(4698, 23399) =     7.99         Prob > F = 0.0000

  28. . margins, dydx(age)

  29. Average marginal effects                          Number of obs   =      28101
  30. Model VCE    : Conventional

  31. Expression   : Linear prediction, predict()
  32. dy/dx w.r.t. : age

  33. ------------------------------------------------------------------------------
  34.              |            Delta-method
  35.              |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
  36. -------------+----------------------------------------------------------------
  37.          age |   .0101694   .0004354    23.35   0.000     .0093159    .0110228
  38. ------------------------------------------------------------------------------
复制代码


报纸
黃河泉 在职认证  发表于 2017-3-5 09:23:56
我猜测原因可能是因为有三个(一般只有一个)交互项所导致的!你或许要试试看
  1. xtreg y c.x1##c.x2##c.x3, fe
复制代码

地板
黃河泉 在职认证  发表于 2017-3-5 09:27:28
简单的例子
  1. webuse nlswork, clear
  2. xtset idcode
  3. xtreg ln_w c.grade##c.age##c.ttl_exp, fe
  4. margins, dydx(age)
复制代码
结果为
  1. Fixed-effects (within) regression               Number of obs     =     28,508
  2. Group variable: idcode                          Number of groups  =      4,708

  3. R-sq:                                           Obs per group:
  4.      within  = 0.1561                                         min =          1
  5.      between = 0.0038                                         avg =        6.1
  6.      overall = 0.0255                                         max =         15

  7.                                                 F(6,23794)        =     733.76
  8. corr(u_i, Xb)  = -0.2859                        Prob > F          =     0.0000

  9. -----------------------------------------------------------------------------------------
  10.                 ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
  11. ------------------------+----------------------------------------------------------------
  12.                   grade |          0  (omitted)
  13.                     age |   .0283974   .0045629     6.22   0.000     .0194537     .037341
  14.                         |
  15.           c.grade#c.age |  -.0026742   .0003784    -7.07   0.000     -.003416   -.0019325
  16.                         |
  17.                 ttl_exp |   .0407879   .0211608     1.93   0.054    -.0006885    .0822644
  18.                         |
  19.       c.grade#c.ttl_exp |   .0054679   .0016966     3.22   0.001     .0021426    .0087933
  20.                         |
  21.         c.age#c.ttl_exp |  -.0016555   .0004883    -3.39   0.001    -.0026126   -.0006985
  22.                         |
  23. c.grade#c.age#c.ttl_exp |  -7.65e-06   .0000389    -0.20   0.844    -.0000838    .0000686
  24.                         |
  25.                   _cons |   1.496277    .019503    76.72   0.000      1.45805    1.534504
  26. ------------------------+----------------------------------------------------------------
  27.                 sigma_u |  .44842416
  28.                 sigma_e |  .29432835
  29.                     rho |  .69890462   (fraction of variance due to u_i)
  30. -----------------------------------------------------------------------------------------
  31. F test that all u_i=0: F(4707, 23794) = 6.06                 Prob > F = 0.0000

  32. . margins, dydx(age)

  33. Average marginal effects                        Number of obs     =     28,508
  34. Model VCE    : Conventional

  35. Expression   : Linear prediction, predict()
  36. dy/dx w.r.t. : age

  37. ------------------------------------------------------------------------------
  38.              |            Delta-method
  39.              |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
  40. -------------+----------------------------------------------------------------
  41.          age |  -.0160191   .0009681   -16.55   0.000    -.0179166   -.0141217
  42. ------------------------------------------------------------------------------
复制代码

7
拂去尘缘 发表于 2017-3-5 14:56:36
蓝色 发表于 2017-3-5 09:11
没有问题啊
是你数据问题
或者stata没有升级的原因吧
老师您好,是这样的,我用我的其他数据做是可以直接使用margins这个命令来做的。但是我现在出现了这样的问题,有没有解决办法?

8
拂去尘缘 发表于 2017-3-5 14:57:20
黃河泉 发表于 2017-3-5 09:27
简单的例子结果为
非常感谢您的回答,我试试看

9
拂去尘缘 发表于 2017-3-5 14:57:39
蓝色 发表于 2017-3-5 09:11
没有问题啊
是你数据问题
或者stata没有升级的原因吧
非常感谢您

10
拂去尘缘 发表于 2017-3-5 15:20:51
黃河泉 发表于 2017-3-5 09:27
简单的例子结果为
非常感谢您,但是我刚才试了我的数据,交叉项很多还是可以做!估计是我数据的问题,只是现在还不知道出现这样的问题应该怎么解决,再次感谢您

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-31 19:04