楼主: 阿袋
11239 6

[学习心得] 普林斯顿“用areg做面板数据回归 [推广有奖]

贵宾

已卖:5773份资源

院士

16%

还不是VIP/贵宾

-

TA的文库  其他...

各科好书新书

投资人生

论文写作投稿实战

威望
0
论坛币
569387 个
通用积分
254.7643
学术水平
304 点
热心指数
347 点
信用等级
246 点
经验
88890 点
帖子
1681
精华
5
在线时间
2905 小时
注册时间
2007-6-10
最后登录
2025-9-8

楼主
阿袋 发表于 2015-5-20 16:48:23 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
总觉得areg这个命定不能做面板数据回归,因为它好像体现不出时间t???!!!
可是看到大牛也用这个命定做面板数据回归,哪位对areg比较熟悉的可以介绍一下吗?为什么它也可以做面板回归????


以下内容来自普林斯顿大学网页:
http://www.princeton.edu/wwac/academic-review/stata/commands/areg/



Commands
areg
This command implements fixed effects regressions on panel data. To implement the model
yit = a + b xit + ci
use the command: areg y x, absorb(i)
Example

. areg crmrte unem, absorb(city)


                                                       Number of obs =      92
                                                       F(  1,    45) =    0.00
                                                       Prob > F      =  0.9764
                                                       R-squared     =  0.8643
                                                       Adj R-squared =  0.7255
                                                       Root MSE      =  15.636

------------------------------------------------------------------------------
      crmrte |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        unem |  -.0180942   .6086846    -0.03   0.976    -1.244048    1.207859
       _cons |    100.935   5.118785    19.72   0.000     90.62526    111.2448
-------------+----------------------------------------------------------------
        city |         F(45, 45) =      6.358   0.000          (46 categories)

Thus we estimate crmrteit= 100.94 - 0.018 unemit + ci. Note that the values of the cis are not reported.
Options

This command can only be used on data in the long format -- where there is a row of data for every pair of values i and t.
The option , r makes Stata calculate robust standard errors (ie, Stata does not assume homoskedasticity).
Other independent variables (that vary for one individual/city) may be added:
areg crmrte unem pop pcinc, absorb(city)
Dummy variables for all but one time period may also be added to estimate the regression model:
yit = a + b xit + ci + dt
areg crmrte unem d87, absorb(city)
In this case, Stata will calculate and display the values of the dts. This data set only has two years of data, so only one dummy is added. If we had data for every year 87-90, it would look like
areg crmrte unem d87 d88 d89, absorb(city)
Notes

Using areg y x, absorb(id) is equivalent to making dummy variables for each value of id and adding them to the regression. Thus the regression areg crmrte unem, absorb(city) r is equivalent to
. capture tab city, gen(city_)

. reg crmrte unem city_*, r

Regression with robust standard errors                 Number of obs =      92
                                                       F( 46,    45) =  131.56
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.8643
                                                       Root MSE      =  15.636

------------------------------------------------------------------------------
             |               Robust
      crmrte |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        unem |  -.0180942   .4419652    -0.04   0.968    -.9082577    .8720694
      city_1 |  -59.66365   5.304407   -11.25   0.000    -70.34727   -48.98002
      city_2 |   38.62867   4.772003     8.09   0.000     29.01736    48.23997
...
     city_45 |  -36.79864   3.956315    -9.30   0.000    -44.76707   -28.83021
     city_46 |  -19.85049   19.24488    -1.03   0.308    -58.61167    18.91069
       _cons |   128.3743   6.501985    19.74   0.000     115.2786      141.47
------------------------------------------------------------------------------
The only difference is that with areg Stata does not display the estimates of all the ci.
See notes on fixed effects models for different ways to implement fixed effects in Stata. areg is almost always the easiest.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:面板数据回归 普林斯顿 面板数据 REG ARE 普林斯顿 command absorb

本帖被以下文库推荐

沙发
hustchen2012 在职认证  发表于 2015-5-20 21:12:11
最近对areg命令也比较  感兴趣,但是遗憾的是并没有完全弄明白和面板回归的关联,帮顶一下坐等高见

藤椅
andruw 在职认证  发表于 2015-5-20 22:45:04
就fixed effect而言, areg 与 xtreg略有不同:
xtreg在估计FE时,不对自由度进行调整;而areg会对自由度进行校正。相应,xtreg估计的系数的standard error会相对小一些。
Acemoglu好像讨论过这个问题,不大记得了。
已有 1 人评分经验 学术水平 热心指数 信用等级 收起 理由
阿袋 + 20 + 5 + 5 + 5 观点有启发

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

板凳
阿袋 发表于 2015-5-21 20:05:31
andruw 发表于 2015-5-20 22:45
就fixed effect而言, areg 与 xtreg略有不同:
xtreg在估计FE时,不对自由度进行调整;而areg会对自由度进 ...
谢谢 你的回答对我很有用 另外,Acemoglu在哪里讨论过?可否告知一下

报纸
阿袋 发表于 2015-5-21 20:23:22
andruw 发表于 2015-5-20 22:45
就fixed effect而言, areg 与 xtreg略有不同:
xtreg在估计FE时,不对自由度进行调整;而areg会对自由度进 ...
找到了
Acemoglu and Johnson (2007)
Disease and Development: The Effect of Life Expectancy on Economic Growth
Daron Acemoglu and Simon Johnson
Journal of Political Economy 115, December 2007: pp. 925-985.
Below are two sets of program files for reproducing the results in Disease and Development. The first, under the heading "Program Files for Use with Stata 10 or higher," will exactly reproduce the paper's results when used with Stata 10 or higher, but will not reproduce the paper's results when used with Stata 9 or lower. We realized after the paper's publication that the Stata procedure used to calculate standard errors with the xtreg command - used throughout the paper - was changed between Stata 9 and Stata 10. In all version of Stata prior to Stata 10, the commands xtreg and areg estimate identical standard errors, as both correct for the degrees of freedom used in estimating fixed effects. In contrast, in Stata 10 and higher, xtreg does not correct for the degrees of freedom used to estimate fixed effects, while areg corrects for the degrees of freedom used to estimate fixed effects in all versions of Stata. Thus xtreg in Stata 10 and higher produces standard errors somewhat smaller than those produced by areg in all versions of Stata or by xtreg in Stata 9 and lower, and Disease and Development can only be reproduced using Stata 10 or higher. (Tables 8 and 9 also use a small sample correction for the standard errors that is only available in Stata 10 or higher.)
For comparison purposes, the second set of program files below, entitled "For use with any version of Stata", uses areg and will produce identical estimates regardless of which version of Stata is used, as areg always corrects the standard errors for the degrees of freedom used to estimate fixed effects. However, these programs will not reproduce the paper's results since they were estimated with xtreg in Stata 10. For more information about the changes in the xtreg procedure in Stata 10, and about the areg and xtreg commands more generally, please see the Stata manuals.
Software requirements: Stata 10 or higher to reproduce the standard errors in the paper.

地板
蓝色 发表于 2015-5-21 21:12:47
对固定效应是没有区别的。
你必须理解面板数据回归的原理。
书上都讲了,xtreg ,fe  是去掉均值
就等价于    reg +虚拟变量的lsdv的回归(伍德里奇,格林的书上都有解释)
而         areg 只不过是因为虚拟变量太多,显示没有意义,而把个体相关的那个省略输出了。手册里面就有介绍




. xtset i t
       panel variable:  i (strongly balanced)
        time variable:  t, 1 to 15
                delta:  1 unit

.  xtreg logc logq logf lf, fe

Fixed-effects (within) regression               Number of obs      =        90
Group variable: i                               Number of groups   =         6

R-sq:  within  = 0.9926                         Obs per group: min =        15
       between = 0.9856                                        avg =      15.0
       overall = 0.9873                                        max =        15

                                                F(3,81)            =   3604.80
corr(u_i, Xb)  = -0.3475                        Prob > F           =    0.0000

------------------------------------------------------------------------------
        logc |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        logq |   .9192846   .0298901    30.76   0.000     .8598126    .9787565
        logf |   .4174918   .0151991    27.47   0.000     .3872503    .4477333
          lf |  -1.070396     .20169    -5.31   0.000    -1.471696   -.6690963
       _cons |   9.713528    .229641    42.30   0.000     9.256614    10.17044
-------------+----------------------------------------------------------------
     sigma_u |   .1320775
     sigma_e |  .06010514
         rho |  .82843653   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0:     F(5, 81) =    57.73               Prob > F = 0.0000

.   areg logc logq logf lf, absorb(i)

Linear regression, absorbing indicators           Number of obs   =         90
                                                  F(   3,     81) =    3604.80
                                                  Prob > F        =     0.0000
                                                  R-squared       =     0.9974
                                                  Adj R-squared   =     0.9972
                                                  Root MSE        =     0.0601

------------------------------------------------------------------------------
        logc |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        logq |   .9192846   .0298901    30.76   0.000     .8598126    .9787565
        logf |   .4174918   .0151991    27.47   0.000     .3872503    .4477333
          lf |  -1.070396     .20169    -5.31   0.000    -1.471696   -.6690963
       _cons |   9.713528    .229641    42.30   0.000     9.256614    10.17044
-------------+----------------------------------------------------------------
           i |          F(5, 81) =     57.732   0.000           (6 categories)

. xi:reg logc logq logf lf i.i
i.i               _Ii_1-6             (naturally coded; _Ii_1 omitted)

      Source |       SS       df       MS              Number of obs =      90
-------------+------------------------------           F(  8,    81) = 3935.79
       Model |   113.74827     8  14.2185338           Prob > F      =  0.0000
    Residual |  .292622872    81  .003612628           R-squared     =  0.9974
-------------+------------------------------           Adj R-squared =  0.9972
       Total |  114.040893    89  1.28135835           Root MSE      =  .06011

------------------------------------------------------------------------------
        logc |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        logq |   .9192846   .0298901    30.76   0.000     .8598126    .9787565
        logf |   .4174918   .0151991    27.47   0.000     .3872503    .4477333
          lf |  -1.070396     .20169    -5.31   0.000    -1.471696   -.6690963
       _Ii_2 |  -.0412359   .0251839    -1.64   0.105    -.0913441    .0088722
       _Ii_3 |  -.2089211   .0427986    -4.88   0.000    -.2940769   -.1237652
       _Ii_4 |   .1845557   .0607527     3.04   0.003     .0636769    .3054345
       _Ii_5 |   .0240547   .0799041     0.30   0.764    -.1349293    .1830387
       _Ii_6 |   .0870617   .0841995     1.03   0.304     -.080469    .2545924
       _cons |   9.705942    .193124    50.26   0.000     9.321686     10.0902
------------------------------------------------------------------------------

.
end of do-file

7
yangchangfan 发表于 2016-9-8 16:17:41
阿袋 发表于 2015-5-21 20:23
找到了
Acemoglu and Johnson (2007)
Disease and Development: The Effect of Life Expectancy on Eco ...
学习了!谢谢分享~

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-1 02:55