楼主: number22
16451 23

高人解答:stata做面板数据固定效应与随机效应的一个问题 [推广有奖]

11
number22 发表于 2010-2-28 17:58:49
10# sungmoo
可以啊 stata10.1 而且我看的一个PPT教程上 有这条命令 真是很头疼啊

12
sungmoo 发表于 2010-2-28 18:05:56
number22 发表于 2010-2-28 17:58 可以啊 stata10.1 而且我看的一个PPT教程上 有这条命令 真是很头疼啊
我看到的是错误信息:

independent variables are collinear with the panel variable district

已经用district定义了panel,自变量再引入i.district,这本身就是多余的。
已有 1 人评分学术水平 热心指数 收起 理由
nlm0402 + 1 + 1 好的意见建议

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

13
蓝色 发表于 2010-2-28 18:08:24
你可以把数据贴出来,运行一下就知道了啊

14
number22 发表于 2010-2-28 18:25:38
12# sungmoo
但是我的stata确实就没提示错误,一个随之而来的问题是:stata在回归 xtreg ……,fe时 显示不出个体固定效应对应的系数(eviews可以)但是根据

xtreg ……,fe=xi: reg …… i.district   用xi: reg …… i.district 命令就可以得到与xtreg相同的系数 并且包括个体固定效应对应的系数。

同样,stata在回归 xtreg …… ,re时也不显示个体随机效应对应的系数(eviews可以),如果要显示 该用什么命令呢? 谢谢!

15
number22 发表于 2010-2-28 18:36:44
13# 蓝色

版主你看 为什么这三个不同命令主要结果一样 ,只是地区虚拟变量那不同?
xtset district year
       panel variable:  district (strongly balanced)
        time variable:  year, 1 to 5
                delta:  1 unit
.
xtreg var8 ti var4 a b,fe
Fixed-effects (within) regression               Number of obs      =       660
Group variable: district                        Number of groups   =       132
R-sq:  within  = 0.5911                         Obs per group: min =         5
       between = 0.7004                                        avg =       5.0
       overall = 0.6042                                        max =         5
                                                F(4,524)           =    189.37
corr(u_i, Xb)  = 0.3915                         Prob > F           =    0.0000
------------------------------------------------------------------------------
        var8 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          ti |  -242.4167   19.49112   -12.44   0.000     -280.707   -204.1263
        var4 |   81.53912   24.10555     3.38   0.001     34.18373    128.8945
           a |   .0333506   .0027825    11.99   0.000     .0278843    .0388168
           b |    .015245   .0025494     5.98   0.000     .0102367    .0202532
       _cons |   197.9695   6.647092    29.78   0.000     184.9112    211.0277
-------------+----------------------------------------------------------------
     sigma_u |  159.92436
     sigma_e |  108.00245
         rho |  .68677695   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. xi:xtreg var8 ti var4 a b i.district,fe
i.district        _Idistrict_1-132    (naturally coded; _Idistrict_1 omitted)
Fixed-effects (within) regression               Number of obs      =       660
Group variable: district                        Number of groups   =       132
R-sq:  within  = 0.5911                         Obs per group: min =         5
       between = 0.7004                                        avg =       5.0
       overall = 0.6042                                        max =         5
                                                F(4,524)           =    189.37
corr(u_i, Xb)  = 0.3915                         Prob > F           =    0.0000
------------------------------------------------------------------------------
        var8 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          ti |  -242.4167   19.49112   -12.44   0.000     -280.707   -204.1263
        var4 |   81.53912   24.10555     3.38   0.001     34.18373    128.8945
           a |   .0333506   .0027825    11.99   0.000     .0278843    .0388168
           b |    .015245   .0025494     5.98   0.000     .0102367    .0202532
_Idistrict_2 |  (dropped)
_Idistrict_3 |  (dropped)
_Idistrict_4 |  (dropped)
_Idistrict_5 |  (dropped)
_Idistrict_6 |  (dropped)
_Idistrict_7 |  (dropped)
_Idistrict_8 |  (dropped)
--more--

. xi:xtreg var8 ti var4 a b i.district,re
i.district        _Idistrict_1-132    (naturally coded; _Idistrict_1 omitted)
Random-effects GLS regression                   Number of obs      =       660
Group variable: district                        Number of groups   =       132
R-sq:  within  = 0.5911                         Obs per group: min =         5
       between = 1.0000                                        avg =       5.0
       overall = 0.8808                                        max =         5
Random effects u_i ~ Gaussian                   Wald chi2(135)     =   3871.97
corr(u_i, X)       = 0 (assumed)                Prob > chi2        =    0.0000
------------------------------------------------------------------------------
        var8 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          ti |  -242.4167   19.49112   -12.44   0.000    -280.6185   -204.2148
        var4 |   81.53912   24.10555     3.38   0.001     34.29311    128.7851
           a |   .0333506   .0027825    11.99   0.000      .027897    .0388041
           b |    .015245   .0025494     5.98   0.000     .0102483    .0202416
_Idistrict_2 |   17.75247    68.3175     0.26   0.795    -116.1474    151.6523
_Idistrict_3 |   51.38357   69.76842     0.74   0.461    -85.36002    188.1272
_Idistrict_4 |    164.425   68.77937     2.39   0.017     29.61995    299.2301
_Idistrict_5 |   45.44195   69.73088     0.65   0.515    -91.22807     182.112
_Idistrict_6 |   25.87626   69.72691     0.37   0.711     -110.786    162.5385
_Idistrict_7 |  -7.751544   69.92745    -0.11   0.912    -144.8068    129.3037
_Idistrict_8 |   94.96308   69.89578     1.36   0.174    -42.03012    231.9563

16
sungmoo 发表于 2010-2-28 20:00:43
number22 发表于 2010-2-28 18:25 stata在回归xtreg ……, re时也不显示个体随机效应对应的系数(eviews可以),如果要显示 该用什么命令呢?
你要的“个体随机效应对应的系数”是什么样的?

可否把你的RE模型的结构(或假设)说明一下?

17
sungmoo 发表于 2010-2-28 20:05:07
number22 发表于 2010-2-28 12:15 stata中输入以下命令:
        xtset district year

        xtreg 因变量 若干自变量,fe                       (1)

xi: xtreg 因变量 若干自变量    i.district, fe        (2)

        xtreg 因变量 若干自变量,   re                    (3)

xi:  xtreg 因变量 若干自变量 i.district, re           (4)
number22 发表于 2010-2-28 13:19 xi:xtreg  因变量 若干自变量 i.district 后就可加fe 或re   而且回归结果是一样的 为什么啊?
number22 发表于 2010-2-28 17:39 能解答下为什么xi:xtreg …… i.district,fexi:xtreg ……i.district ,re的回归结果相同吗?
number22 发表于 2010-2-28 18:25 但是我的stata确实就没提示错误,一个随之而来的问题是:stata在回归 xtreg ……,fe时 显示不出个体固定效应对应的系数(eviews可以)但是根据xtreg ……,fe=xi: reg …… i.district   用xi: reg …… i.district 命令就可以得到与xtreg相同的系数 并且包括个体固定效应对应的系数。
请注意:你前后的说法(涉及的命令)并不一致——这就是问题所在。

18
number22 发表于 2010-2-28 20:56:08
17# sungmoo
版主啊 我发你短消息了 你能加我下qq吗 麻烦了

19
number22 发表于 2010-2-28 21:23:58
[url=http://www.pinggu.org/bbs/redirect.php?goto =findpost&pid=5008521&ptid=722788]16#[/url] sungmoo

找了张图 举个例子 就是图中“Random Effects ”对应的系数eviews 中是有这列的 stata中没有

20
sungmoo 发表于 2010-2-28 23:25:51
number22 发表于 2010-2-28 21:23 就是图中“Random Effects ”对应的系数eviews 中是有这列的 stata中没有
*在xtreg ……, re之后

predict u, u

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

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