楼主: Catherine78
488 0

[回归分析求助] 如何用stata预测出含有随机变量的多层回归的误差项的残差 [推广有奖]

  • 0关注
  • 0粉丝

初中生

28%

还不是VIP/贵宾

-

威望
0
论坛币
906 个
通用积分
0.1500
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
30 点
帖子
1
精华
0
在线时间
28 小时
注册时间
2021-11-11
最后登录
2024-5-5

80论坛币
多层回归是以lnhi为因变量,第一层为家庭层面变量,第二层为社区层面变量.
随机变量为第一层家庭层面变量的三个变量employment0,contract0,ms0.
第一层与第二层的交互项为infrahea infranyou lnrentpro.

通过以下公式
. xtmixed lnhi ae hoff ahh as welfare nprechildren0 nyouth0 health0 hukou0 province0 contract0 ms0 education0 employment0 foreignen0 lnrentmonth infra outsiderrate citycentre infrahea infranyou lnrentpro ||community: employment0 contract0 ms0  ,covariance(unstructured)mle variance nostderr

得到结果如下
Performing EM optimization:

Performing gradient-based optimization:

Iteration 0:   log likelihood = -3938.9421  
Iteration 1:   log likelihood = -3918.8907  
Iteration 2:   log likelihood =  -3916.683  
Iteration 3:   log likelihood = -3916.1721  
Iteration 4:   log likelihood = -3916.1621  
Iteration 5:   log likelihood =  -3916.162  

Mixed-effects ML regression                     Number of obs     =      4,960
Group variable: community                       Number of groups  =        777

                                                Obs per group:
                                                              min =          1
                                                              avg =        6.4
                                                              max =         23

                                                Wald chi2(22)     =     965.77
Log likelihood =  -3916.162                     Prob > chi2       =     0.0000

-------------------------------------------------------------------------------
         lnhi |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
           ae |  -.1352636   .0145054    -9.33   0.000    -.1636937   -.1068334
         hoff |   .0254234   .0168387     1.51   0.131    -.0075798    .0584267
          ahh |   -.031284   .0045458    -6.88   0.000    -.0401935   -.0223744
           as |    .000301   .0000427     7.04   0.000     .0002173    .0003848
      welfare |   .1636618   .0223649     7.32   0.000     .1198273    .2074962
nprechildren0 |  -.0615714   .0243786    -2.53   0.012    -.1093525   -.0137902
      nyouth0 |   .1832795   .0894212     2.05   0.040     .0080171    .3585419
      health0 |  -.2402865   .1709696    -1.41   0.160    -.5753808    .0948077
       hukou0 |  -.0487206   .0529253    -0.92   0.357    -.1524522     .055011
    province0 |   1.366377   .2541377     5.38   0.000     .8682765    1.864478
    contract0 |   -.037752   .0234495    -1.61   0.107    -.0837122    .0082081
          ms0 |  -.2265804   .0359663    -6.30   0.000     -.297073   -.1560878
   education0 |   -.217519    .094689    -2.30   0.022     -.403106   -.0319319
  employment0 |  -.3222104   .0464335    -6.94   0.000    -.4132185   -.2312024
   foreignen0 |  -.0407325   .0335906    -1.21   0.225     -.106569    .0251039
  lnrentmonth |   .3385035   .0209773    16.14   0.000     .2973887    .3796183
        infra |   .2711109   .1203626     2.25   0.024     .0352045    .5070174
outsiderrate |   .4134183   .0819529     5.04   0.000     .2527936    .5740429
   citycentre |  -.0873414   .0258826    -3.37   0.001    -.1380703   -.0366125
     infrahea |   .0636582   .2165111     0.29   0.769    -.3606958    .4880122
    infranyou |  -.1888744   .1137035    -1.66   0.097    -.4117292    .0339805
    lnrentpro |  -.2343589   .0404085    -5.80   0.000     -.313558   -.1551598
        _cons |   8.606703   .2044827    42.09   0.000     8.205924    9.007482
-------------------------------------------------------------------------------

------------------------------------------------------------------------------
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
community: Unstructured      |
               var(employ~0) |   .1042985          .             .           .
               var(contra~0) |   .0232955          .             .           .
                    var(ms0) |   .0615176          .             .           .
                  var(_cons) |   .0809399          .             .           .
      cov(employ~0,contra~0) |   .0229407          .             .           .
           cov(employ~0,ms0) |   .0040406          .             .           .
         cov(employ~0,_cons) |   -.011397          .             .           .
           cov(contra~0,ms0) |    .003976          .             .           .
         cov(contra~0,_cons) |  -.0168323          .             .           .
              cov(ms0,_cons) |   -.010932          .             .           .
-----------------------------+------------------------------------------------
               var(Residual) |    .232012          .             .           .
------------------------------------------------------------------------------
LR test vs. linear model: chi2(10) = 541.39               Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

.

想要预测出家庭层面,社区层面以及家庭和社区层面的误差项的残差
然而直接使用predict u0 u1,reffects指令一直报错.
望大神提供帮助。



关键词:Stata tata 随机变量 如何用 误差项 多层回归
您需要登录后才可以回帖 登录 | 我要注册

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

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

GMT+8, 2024-5-7 22:36