在Stata中估计Fixed and Random Effects-经管之家官网!

人大经济论坛-经管之家 收藏本站
您当前的位置> 软件培训>>

Stata软件培训

>>

在Stata中估计Fixed and Random Effects

在Stata中估计Fixed and Random Effects

发布:luyunhang | 分类:Stata软件培训

关于本站

人大经济论坛-经管之家:分享大学、考研、论文、会计、留学、数据、经济学、金融学、管理学、统计学、博弈论、统计年鉴、行业分析包括等相关资源。
经管之家是国内活跃的在线教育咨询平台!

经管之家新媒体交易平台

提供"微信号、微博、抖音、快手、头条、小红书、百家号、企鹅号、UC号、一点资讯"等虚拟账号交易,真正实现买卖双方的共赢。【请点击这里访问】

提供微信号、微博、抖音、快手、头条、小红书、百家号、企鹅号、UC号、一点资讯等虚拟账号交易,真正实现买卖双方的共赢。【请点击这里访问】

FixedandRandomEffectsIX.FixedEffects.A.UnmodeledHeterogeneity.Wehopethatourindependentvariableshaveexplainedmuchofwhatisdifferentaboutanobservation,aunit,orayear,butthereisprobablysomeunmodeledheterog ...
免费学术公开课,扫码加入


Fixed and Random Effects


IX. Fixed Effects.
A. Unmodeled Heterogeneity.We hope that our independent variables have explained much of what is different about an observation, a unit, or a year, but there is probably some unmodeled heterogeneity.Since we haven’t modeled it, it goes into ei,t.The real problem comes when some units (or, less commonly, time periods) share some unmodeled heterogeneity.We’d love to be able to explain everything that makes Luxembourg different, but usually we can’t, so we need to violate the prohibition on using proper names as independent variables and do something to remove this shared and thus systematic heterogeneity from the error term.

B. The Fixed Effects Model in Concept.One way to do this is to estimate a “fixed effects” model that gives Luxembourg and every other unit in our study its own intercept.The most intuitive way to do this would be by including a dummy variable for N-1 units.We still assume that the betas pool across units, so in essence we have N parallel regression lines.Observations across time in each unit vary around a baseline level specific that unit.Note that any substantive explanatory variables that do not vary across time in each unit will be perfectly collinear with the fixed effects, and so we cannot include them in the model (or estimate their effects).

yi,t = αi+ xi,tβ + ei,t
C. Sketch of a Test for Fixed Effects.The null hypothesis is that our simple, restrictive model was appropriate, that all of the units share the same intercept.The alternative is that they vary across units, so the way to test this is by running both models and then comparing their sum of squares in a joint F-test.

D. Estimating the Fixed Effects Model.We could just include dummy variables for all but one of the units.If we have panel data, though, this sacrifices a lot of degrees of freedom.And with so many units and very few time periods, these intercepts may be picking up on a lot of random error and thus be quite inconsistent.We’re not going to learn much of substance from these “incidental” or “nuisance” parameters.So this frees us to estimate the effect of our substantive coefficients in a slightly different way that preserves the substantive story of fixed effects without costing us so many degrees of freedom.We convert our xs and y for each observation into a deviation from the mean in that unit.This “sweeps out the unit effects” because when you mean deviate variables, you no longer need to include an intercept term.So the model regresses yi,t – mean(yi) on xi,t – mean(xi).This is often called this “within” estimator because it looks at how changes in the explanatory variables cause y to vary around a mean within the unit.Stata has a canned procedure that (I believe) transforms your variables in this way and then corrects the standard errors to reflect the fact that N of your observations bring no new information (since they are determined by the mean and the other observations for each unit).
xtreg DiscretionarySpending salary totalday staffper init ideo leg_dd gov_dem docs_g senc_g medi_g noreast, fe
Fixed-effects (within) regression Number of obs = 616
Group variable (i): alpha Number of groups = 44
R-sq:within= 0.0126 Obs per group: min = 14
between = 0.0232 avg = 14.0
overall = 0.0053 max = 14
F(3,569) = 2.42
corr(u_i, Xb)= -0.3025 Prob > F = 0.0648
------------------------------------------------------------------------------
Discretion~g | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
salary |-2.94e-06 5.26e+07 -0.00 1.000 -1.03e+08 1.03e+08
totalday |(dropped)
staffper |(dropped)
init |(dropped)
ideol |(dropped)
leg_dd |-.1616329 .0701156 -2.31 0.022 -.29935 -.0239159
gov_dem |-.0682768 .0426327 -1.60 0.110 -.1520135 .0154599
docs_g |(dropped)
senc_g |(dropped)
medi_g |(dropped)
noreast |(dropped)
_cons | 4.374255 1.33e+12 0.00 1.000 -2.62e+12 2.62e+12
-------------+----------------------------------------------------------------
sigma_u |.51059043
sigma_e |.42354445
rho |.59238137 (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(43, 569) = 7.86 Prob > F = 0.0000
X. Random Effects
A. The Random Effects Model in Concept.Instead of thinking of each unit as having its own systematic baseline, we think of each intercept as the result of a random deviation from some mean intercept.The intercept is a draw from some distribution for each unit, and it is independent of the error for a particular observation.Instead of trying to estimate N parameters as in fixed effects, we just need to estimate parameters describing the distribution from which each unit’s intercept is drawn.If we have a large N (panel data), we will be able to do this, and random effects will be more efficient than fixed effects.It has N more degrees of freedom, and it also uses information from the “between” estimator (which averages observations over a unit and regresses average y on average x to look at differences across units).Another nice property is that you can still have explanatory variables that don’t change over time for a unit.If we have a big T (TS-CS data), then the difference between fixed effects and random effects goes away.
yi,t = μ + αi+ xi,tβ + ei,t
B. Sketch of a Test for Random Effects.A small assumption is that Cov(αi , ei) = 0.A huge assumption is that Cov(αi , xi) = 0, which means that the things that make a unit’s intercept different are unrelated to the country’s xs.In concept, a test regresses the errors on the xs.

C. Estimating the Random Effects Model.
xtreg DiscretionarySpending salary totalday staffper init ideo leg_dd gov_dem docs_g senc_g medi_g noreast, re
Random-effects GLS regression Number of obs = 616
Group variable (i): alpha Number of groups = 44
R-sq:within= 0.0125 Obs per group: min = 14
between = 0.5560 avg = 14.0
overall = 0.3272 max = 14
Random effects u_i ~ Gaussian Wald chi2(11) = 53.09
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
------------------------------------------------------------------------------
Discretion~g | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
salary | 8.34e-06 5.39e-06 1.55 0.122 -2.23e-06 .0000189
totalday | .0000968 .0008137 0.12 0.905 -.0014979 .0016916
staffper |-.0223183 .0209193 -1.07 0.286 -.0633193 .0186828
init |-.2080793 .1182186 -1.76 0.078 -.4397836 .0236249
ideol | .6509317 .8078395 0.81 0.420 -.9324047 2.234268
leg_dd |-.1153163 .064981 -1.77 0.076 -.2426768 .0120442
gov_dem |-.0570731 .042057 -1.36 0.175 -.1395033 .0253572
docs_g | .0700836 .0764945 0.92 0.360 -.0798429 .2200101
senc_g | .056224 .1389907 0.40 0.686 -.2161928 .3286409
medi_g | .1813995 .0828276 2.19 0.029 .0190605 .3437385
noreast | .4777465 .126015 3.79 0.000 .2307616 .7247314
_cons | 3.74571 .2060277 18.18 0.000 3.341903 4.149517
-------------+----------------------------------------------------------------
sigma_u |.32985269
sigma_e |.42354445
rho |.37753489 (fraction of variance due to u_i)
------------------------------------------------------------------------------
「经管之家」APP:经管人学习、答疑、交友,就上经管之家!
免流量费下载资料----在经管之家app可以下载论坛上的所有资源,并且不额外收取下载高峰期的论坛币。
涵盖所有经管领域的优秀内容----覆盖经济、管理、金融投资、计量统计、数据分析、国贸、财会等专业的学习宝库,各类资料应有尽有。
来自五湖四海的经管达人----已经有上千万的经管人来到这里,你可以找到任何学科方向、有共同话题的朋友。
经管之家(原人大经济论坛),跨越高校的围墙,带你走进经管知识的新世界。
扫描下方二维码下载并注册APP
本文关键词:

本文论坛网址:https://bbs.pinggu.org/thread-18628-1-1.html

人气文章

1.凡人大经济论坛-经管之家转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
经管之家 人大经济论坛 大学 专业 手机版