短面板数据分析的基本程序.ppt

上传人:罗晋 文档编号:9199171 上传时间:2021-02-07 格式:PPT 页数:59 大小:1.39MB
返回 下载 相关 举报
短面板数据分析的基本程序.ppt_第1页
第1页 / 共59页
短面板数据分析的基本程序.ppt_第2页
第2页 / 共59页
短面板数据分析的基本程序.ppt_第3页
第3页 / 共59页
短面板数据分析的基本程序.ppt_第4页
第4页 / 共59页
短面板数据分析的基本程序.ppt_第5页
第5页 / 共59页
点击查看更多>>
资源描述

《短面板数据分析的基本程序.ppt》由会员分享,可在线阅读,更多相关《短面板数据分析的基本程序.ppt(59页珍藏版)》请在三一文库上搜索。

1、短面板数据分析的基本程序,2013,参考书,计量经济学导论第四版(伍德里奇)中文版或英文版 用Stata学计量经济学 高级计量经济学及stata应用(陈强),内容安排,第1讲 短面板数据分析 第2讲 长面板数据分析(PPT 第3讲 内生性与工具变量法 第4讲动态面板数据模型 第5讲双重差分模型及其应用 第6讲 基于DID的权威文献做对了吗? (学生报告与讨论) 第7讲PSMDID 第8讲 如何识别核心变量的作用机制?,短面板数据,面板数据(panel data)是同时在时间和截面上取得的二维数据,也称时间序列与截面混合数据(pooled time series and cross sectio

2、n data)。 是在一段时间内跟踪同一组个体的数据。既有横截面的维度(n个个体),又有时间维度(T个时期)。,Stata中面板数据结构,短面板:NT;反之为长面板。 平衡面板数据(balanced panel data):如果每个个体在相同的时间内都有观测值记录。 For any i, there are T observations. 非平衡面板数据(unbalanced panel):T may different over i.,Benefits of panel data analysis,use traffic.dta des,第一步:构造计量模型,面板数据模型,非观测效应模型(u

3、nobserved effects model) 固定效应模型(Fixed Effects Model, FE) 随机效应模型(Random Effects Model, RE) 混合回归模型(Pooled Regression Model),固定效应模型(Fixed Effects Model, FE),随机效应模型(Random Effects Model, RE),混合回归模型(Pooled Regression Model),模型的估计,固定效应模型 固定效应变换(Fixed Effects Transformation) (组内变换)(Within Transformation) L

4、SDV (Least Square Dummy Variable,(式1),给定第i 个个体,将(式1)两边对时间取平均可得,,(式2),固定效应变换,(式1) (式2)得:,可以用OLS方法估计 ,称为“固定效应估计量”(Fixed Effects Estimator),记为,由于 主要使用了每个个体的组内离差信息,故也称为“组内估计量”(within estimator)。,令 ,则,Stata 命令,xtreg ,fe xi: xtreg i.year, fe,LSDV(Least Square Dummy Variable ),基本思想:将不可观测的个体效应ai 看做待估计的参数,ai

5、就是第i个个体的截距。估计n个截距的方法就是引入n1个虚拟变量(如果省略常数项,则引入n个虚拟变量)。,例如:共有7个州,方程可以写成:,7个州的回归线斜率相同,但截距不同。 第1个州的截距是: 第2个州的截距是: 第3个州的截距是: 第4个州的截距是:,Stata 命令,xi: reg i.code xi: reg i.code i.year,随机效应模型估计,GLS The usual pooled OLS can give consistent estimators ,but as its standard errors ignore the positive serial correl

6、ation in the composite error term, they will be incorrect.,Solution: GLS transformation to eliminate the serial correlation,:,These estimators can be based on the pooled OLS or fixed effects residuals.,Random Effects Estimator: The feasible GLS estimator that uses,in place of,RE, FE and PLS,Pooled O

7、LS: Fixed Effects Estimator:,Stata 命令,xtreg ,re xi:xtreg i.year ,re,进一步的解释,heteroscedasticity consistent or “White” standard errors are obtained by choosing option vce(robust) which is available for most estimation commands.,Statas estimation commands with option robust also contain a cluster() opti

8、on and it is this option which allows the computation of so-called Rogers or clustered standard errors.,But,While all these techniques of estimating the covariance matrix are robust to certain violations of the regression model assumptions, they do not consider cross-sectional correlation. However,

9、due to social norms and psychological behavior patterns, spatial dependence can be a problematic feature of any microeconometric panel dataset even if the cross-sectional units(e.g. individuals or firms) have been randomly selected.,*引入了时 间虚拟变量 导致exper 消失,第2步:描述性统计,变量解释与变量的描述性统计 use traffic.dta xtse

10、t state year sum fatal beertax spircons unrate perinck 关键变量与被解释变量的散点图并画出回归直线 twoway (scatter fatal beertax) (lfit fatal beertax),PLS or FE tab year, gen(year) 1. xtreg fatal beertax spircons unrate perinck year2-year7,fe 这里误差项可能存在自相关、异方差和截面相关问题,所以F检验显示的结果可能不可靠,所以严格的话,首先要检验是否存在截面相关问题,命令如下: xtcsd,pes

11、xtcsd,fri xtcsd,fre,第3步:模型选择,Testing for Cross-sectional Dependence,xtcsd 短面板 xttest2 长面板 xtcsd is a postestimation command valid for use after running an FE or RE model. xtcsd can also perform Pesarans CD test for unbalanced panels.,PLS or FE,在使用命令“xtreg,fe ”时,如果不加选项cluster(state),则输出结果还包含一个F检验,其原假

12、设为“H0:all ui=0”,即混合回归是可以接受的。,2. xi:xtscc fatal beertax spircons unrate perinck year2-year7 i.state 对州虚拟变量做F检验 如果不存在截面相关,则 xi:reg fatal beertax spircons unrate perinck year2-year7 i.state, cluster(state) 对州虚拟变量做F检验,PLS or RE xtreg fatal beertax spircons unrate perinck year2-year7,re xttest0/xttest1(A

13、R(1)),PLS or RE,FE or RE Hausman test1 xtreg fatal beertax spircons unrate perinck year2-year7, fe est store FE xtreg fatal beertax spircons unrate perinck year2-year7, re hausman FE, sigmamore,Hausman检验: 基本思想:如果 , Fe 和 Re 都是一致的,但Re更有效。 如果 , Fe 仍然一致,但Re是有偏的。 因此: 如果原假设成立,则FE与RE估计量将共同收敛于真实的参数值,反之,两者的差

14、距过大,则倾向于拒绝原假设,选择FE,FE or RE,解决办法:构造一个辅助回归,继续,基于随机效应估计的自相关检验 xtserial fatal beertax spircons unrate perinck year2-year7,Hausman test2,quietly xtreg fatal beertax spircons unrate perinck year2 year3 year4 year5 year6 year7, re scalar theta=e(theta) global yandxforhausman fatal beertax spircons unrate

15、perinck year2 year3 year4 year5 year6 year7 sort state foreach x of varlist $yandxforhausman by state:egen meanx=mean(x) gen mdx=x-meanx gen redx=x-theta*meanx quietly reg redfatal redbeertax redspircons redunrate redperinck redyear2 redyear3 redyear4 redyear5 redyear6 redyear7 mdbeertax mdspircons

16、mdunrate mdperinck mdyear2 mdyear3 mdyear4 mdyear5 mdyear6 mdyear7, vce(cluster state) test mdbeertax mdspircons mdunrate mdperinck mdyear2 mdyear3 mdyear4 mdyear5 mdyear6 mdyear7,Hausman test 3,基于随机效应估计的截面相关检验 xtreg fatal beertax spircons unrate perinck year2-year7, re xtcsd,pes abs xtcsd,fri abs x

17、tcsd,fre abs,Hausman test3,quietly xtscc redfatal redbeertax redspircons redunrate redperinck redyear2 redyear3 redyear4 redyear5 redyear6 redyear7 mdbeertax mdspircons mdunrate mdperinck mdyear2 mdyear3 mdyear4 mdyear5 mdyear6 mdyear7 test mdbeertax mdspircons mdunrate mdperinck mdyear2 mdyear3 mdy

18、ear4 mdyear5 mdyear6 mdyear7,第4步:报告计量结果,假设Hausman test 选择FE,则 xtreg fatal beertax spircons unrate perinck year2-year7, fe xtcsd,pes abs xtcsd,fri abs xtcsd,fre abs,如果存在截面相关,则最终报告由如下命令估计的结果: xtscc fatal beertax spircons unrate perinck year2-year7, fe 其中标准误是Driscoll-Kraay,估计量是组内估计量 如果不存在截面相关,则检验是否存在异方

19、差 xtreg fatal beertax spircons unrate perinck year2-year7, fe xttest3 *一般都存在异方差,如果存在异方差(且存在自相关,前面已做过自相关的检验),则最终报告由如下命令估计的结果: xtreg fatal beertax spircons unrate perinck year2-year7, fe cluster(state) *标准误是Rogers or clustered standard errors.,假设Hausman test 选择RE,则最终报告由如下命令估计的结果: xtreg fatal beertax spircons unrate perinck year2-year7, re cluster(state) *xtscc 不能处理随机效应的截面相关问题 * 聚类稳健的标准误:对自相关和异方差稳健,练习1,要求,描述性统计并作图 模型选择 PLS or FE ? PLS or RE ? FE or RE ? (三种Hausman Test) 3. 报告计量结果并和上表中的结果进行比较,练习2,要求,描述性统计并作图 模型选择 PLS or FE ? PLS or RE ? FE or RE ? (三种Hausman Test) 3. 报告计量结果,Thank you!,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 科普知识


经营许可证编号:宁ICP备18001539号-1