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

上传人:牧羊曲112 文档编号:2131728 上传时间:2023-01-15 格式:PPT 页数:59 大小:1.39MB
返回 下载 相关 举报
短面板数据分析的基本程序ppt课件.ppt_第1页
第1页 / 共59页
短面板数据分析的基本程序ppt课件.ppt_第2页
第2页 / 共59页
短面板数据分析的基本程序ppt课件.ppt_第3页
第3页 / 共59页
短面板数据分析的基本程序ppt课件.ppt_第4页
第4页 / 共59页
短面板数据分析的基本程序ppt课件.ppt_第5页
第5页 / 共59页
点击查看更多>>
资源描述

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

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

2、cross section 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,第一步:构造计量模型,面板数据模型,非观

3、测效应模型(unobserved 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)LSDV

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

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

6、te 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 OLS:Fixed Effects Estimat

7、or:,Stata 命令,xtreg,rexi: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()option and it is this option which a

8、llows 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,due to social norms and psychologic

9、al 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 xtset state year sum fatal beertax spircons u

10、nrate 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 xtcsd,fri xtcsd,fre,第3步:模型选择,Testing for Cross-s

11、ectional 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检验,其原假设为“H0:all ui=0”,即混合回归是可以接受的。,2.xi:xtscc fatal beerta

12、x spircons unrate perinck year2-year7 i.state 对州虚拟变量做F检验 如果不存在截面相关,则 xi:reg fatal beertax spircons unrate perinck year2-year7 i.state,cluster(state)对州虚拟变量做F检验,PLS or RExtreg fatal beertax spircons unrate perinck year2-year7,rexttest0/xttest1(AR(1)),PLS or RE,FE or REHausman test1 xtreg fatal beertax

13、 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估计量将共同收敛于真实的参数值,反之,两者的差距过大,则倾向于拒绝原假设,选择FE,FE or RE,解决办法:构造一个辅助回归,继续,基于随机效应估计的自相关检验 xtserial

14、fatal beertax spircons unrate perinck year2-year7,Hausman test2,quietly xtreg fatal beertax spircons unrate perinck year2 year3 year4 year5 year6 year7,rescalar theta=e(theta)global yandxforhausman fatal beertax spircons unrate perinck year2 year3 year4 year5 year6 year7 sort stateforeach x of varli

15、st$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 mdunrate mdperinck mdyear2 mdyear3 mdyear4 mdyear5 mdyear6 mdyear7,vce(clus

16、ter 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 xtcsd,fre abs,Hausman test3,quietly xtscc redfatal redbeertax redspircons redun

17、rate redperinck redyear2 redyear3 redyear4 redyear5 redyear6 redyear7 mdbeertax mdspircons mdunrate mdperinck mdyear2 mdyear3 mdyear4 mdyear5 mdyear6 mdyear7test mdbeertax mdspircons mdunrate mdperinck mdyear2 mdyear3 mdyear4 mdyear5 mdyear6 mdyear7,第4步:报告计量结果,假设Hausman test 选择FE,则 xtreg fatal beert

18、ax 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,估计量是组内估计量 如果不存在截面相关,则检验是否存在异方差 xtreg fatal beertax spircons unrate perinck year2-year7,fexttest3*一般都存在异方差,如果存在异

19、方差(且存在自相关,前面已做过自相关的检验),则最终报告由如下命令估计的结果: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备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号