计量经济学面板数据stata操作方法

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Lv Xiaofeng: lvxf@swufe.edu.cn
Linear Models for Panel Data: Fixed effects and Random effects
3.1 Fixed effects model: specification Model specification yit = αi + xit β + uit , i = 1, ..., n, t = t1 , ..., tT It assumes 1)αi is different across i . if it is constant across i , then we can use multiple linear regression. 2) αi is correlated with xit . 3) αi is uncorrelated with uit . 4) uit is i.i.d.
Lv Xiaofeng: lvxf@swufe.edu.cn
Linear Models for Panel Data: Fixed effects and Random effects
4.2 random effects model: estimation 2 2 2 σv σc · · · σc σ2 σ2 · · · σ2 c v c Let Ωvi = . , where . . . . . . ··· . . 2 2 2 σc σc · · · σv T ×T 2 2 σc = var (ci ), σv = var (uit ) + var (ci ). To estimate the coefficients, we apply weighed multiple linear regression or maximum likelihood method. For example, insheet using Cigar.csv xtset state year xtreg price pop pop16 cpi ndi sales pimin, re
Lv Xiaofeng: lvxf@swufe.edu.cn Linear Models for Panel Data: Fixed effects and Random effects
5 Comparing the two models 1. If ui is independent of xit , both fixed and random effects models are consistent. But the fixed effects model is more efficient than the other one. 2. If ui is correlated with xit , the fixed is consistent and the random is inconsistent. So generally, we choose the fixed to obtain conservative estimation. Fortunately, Hausman test can help us to choose the better one.
6.6 choosing the two models hausman fixed random
Lv Xiaofeng: lvxf@swufe.edu.cn
Fra Baidu bibliotek
Linear Models for Panel Data: Fixed effects and Random effects
7 practice
Using the 12 given data sets to practice panel data models.
Contents Important commands Comparing data frame Fixed effects model Random effects model Comparing the two models Choosing the two models Practice
Lv Xiaofeng: lvxf@swufe.edu.cn Linear Models for Panel Data: Fixed effects and Random effects
t =t1
1 T
tT
xit , ui =
t =t1
1 T
tT
uit ,
t =t1
y ¨it = yit − yi , x ¨it − xi , u ¨it = uit − ui . Then we have: y ¨it = x ¨it β + u ¨it The fixed effects model aims to estimate β by controlling αi . for example, insheet using Cigar.csv xtset state year xtreg price pop pop16 cpi ndi sales pimin, fe
Lv Xiaofeng: lvxf@swufe.edu.cn Linear Models for Panel Data: Fixed effects and Random effects
4.1 random effects model: specification
Model specification yit = αi + xit β + uit , i = 1, ..., n, t = t1 , ..., tT , Equivalently, yit = α + xit β + ci + uit , ci = αi − α It assumes 1) αi is uncorrelated with xit . 2) αi is uncorrelated with uit . 3) uit is i.i.d.
Lv Xiaofeng: lvxf@swufe.edu.cn
Linear Models for Panel Data: Fixed effects and Random effects
6.4 choosing the two models
Lv Xiaofeng: lvxf@swufe.edu.cn
Linear Models for Panel Data: Fixed effects and Random effects
1
2
3
4
5
6
7
1 Important commands
xtset id t xtreg y x, fe estimates store fixed xtreg y x, re estimates store random hausman fixed random
Lv Xiaofeng: lvxf@swufe.edu.cn
6.5 choosing the two models xtreg price pop pop16 cpi ndi sales pimin, re
estimates store random
Lv Xiaofeng: lvxf@swufe.edu.cn Linear Models for Panel Data: Fixed effects and Random effects
Linear Models for Panel Data: Fixed effects and Random effects models Lv Xiaofeng: lvxf@swufe.edu.cn
April 14, 2014
Lv Xiaofeng: lvxf@swufe.edu.cn Linear Models for Panel Data: Fixed effects and Random effects
Lv Xiaofeng: lvxf@swufe.edu.cn Linear Models for Panel Data: Fixed effects and Random effects
6.1 Choosing the two models
To decide between fixed or random effects you can run a Hausman test where the null hypothesis is that the preferred model is random effects vs. the alternative the fixed effects (see Green, 2008, chapter 9). It basically tests whether the unique errors (ui) are correlated with the regressors, the null hypothesis is they are not.
Lv Xiaofeng: lvxf@swufe.edu.cn
Linear Models for Panel Data: Fixed effects and Random effects
6.2 Choosing the two models
Run a fixed effects model and save the estimates, then run a random model and save the estimates, then perform the test. See below. xtreg y x, fe estimates store fixed xtreg y x, re estimates store random hausman fixed random
Lv Xiaofeng: lvxf@swufe.edu.cn
Linear Models for Panel Data: Fixed effects and Random effects
Linear Models for Panel Data: Fixed effects and Random effects
2 Comparing data frame cross-sectional data time sereires panel data id t id t 1 1992 1 1992 . . . . 1 1 . . 1995 1 1995 1 2 1992 2 1992 . . . . 2 . 2 . 2 1995 2 1995 . . . . . . . . . . . .
Lv Xiaofeng: lvxf@swufe.edu.cn Linear Models for Panel Data: Fixed effects and Random effects
3.2 Fixed effects model: estimation Let yi =
1 T tT
yit , xi =
Lv Xiaofeng: lvxf@swufe.edu.cn
Linear Models for Panel Data: Fixed effects and Random effects
6.3 choosing the two models
insheet using Cigar.csv xtset state year xtreg price pop pop16 cpi ndi sales pimin, fe estimates store fixed
相关文档
最新文档