Stata:面板数据分析命令汇总

您所在的位置:网站首页 混合ols模型命令 Stata:面板数据分析命令汇总

Stata:面板数据分析命令汇总

2023-05-13 01:32| 来源: 网络整理| 查看: 265

tsset company year

tsset industry year

产生新的变量:gennewvar=human*lnrd

产生滞后变量Genfiscal(2)=L2.fiscal

产生差分变量Genfiscal(D)=D.fiscal

一、描述性统计

xtdes :对Panel Data截面个数、时间跨度的整体描述

Xtsum:分组内、组间和样本整体计算各个变量的基本统计量

xttab 采用列表的方式显示某个变量的分布

二、主要命令和方法

Stata中用于估计面板模型的主要命令:xtreg

xtreg depvar [varlist] [if exp] , model_type [level(#) ]

Model type 模型

be Between-effects estimator

fe Fixed-effects estimator

re GLSRandom-effects estimator

pa GEEpopulation-averaged estimator

mle Maximum-likelihood Random-effectsestimator

主要估计方法:

xtreg: Fixed-, between- and random-effects, and population-averaged linear models

xtregar:Fixed- andrandom-effects linear models with an AR(1) disturbance

xtpcse :OLS orPrais-Winsten models with panel-corrected standard errors

xtrchh :Hildreth-Houckrandom coefficients models

xtivreg :Instrumentalvariables and two-stage least squares for panel-data models

xtabond:Arellano-Bond linear, dynamic panel data estimator

xttobit :Random-effectstobit models

xtlogit :Fixed-effects,random-effects, population-averaged logit models

xtprobit :Random-effects andpopulation-averaged probit models

xtfrontier :Stochastic frontiermodels for panel-data

xtrc gdp invest culture edu sci health social admin,beta

三、xtreg命令的应用

声明面板数据类型:

*1、面板声明

use FDI.dtar, clear

xtset id year

1.固定效应模型估计:

xtreg xtreg lngdp lnfdi lnie lnex lnim lnci lngp,fe

2.随机效应模型估计:

xtreg xtreg lngdp lnfdi lnie lnex lnim lnci lngp,re

3. 最大似然估计Ml:

xtreg xtreg lngdp lnfdi lnie lnex lnim lnci lngp,mle

Hausman检验究竟选择固定效应模型还是随机效应模型:

第一步:估计固定效应模型,存储结果

xtreg xtreg lngdp lnfdi lnie lnex lnim lnci lngp,fe

est store fe

第二步:估计随机效应模型,存储结果

xtreg xtreg lngdp lnfdi lnie lnex lnim lnci lngp,re

est store re

第三步:进行hausman检验

hausman fe re

对于固定效应模型的异方差检验和序列相关检验:

xtserial xtreg lngdp lnfdi lnie lnex lnim lnci lngp

异方差检验:

xtreg xtreg lngdp lnfdi lnie lnex lnim lnci lngp,fe

xttest3 (Modified Wald statistic for groupwise heteroskedasticity in fixedeffect model)

随机效应模型的序列相关检验:

xtreg xtreg lngdp lnfdi lnie lnex lnim lnci lngp,re

xttest1

xttest1用于检验随机效应(单尾和双尾) 、一阶序列相关以及两者的联合显著

检验结果表明存在随机效应和序列相关,而且对随机效应和序列相关的联合检验也非常显著

可以使用广义线性模型xtgls对异方差和序列相关进行修正:

xtgls xtreg lngdp lnfdi lnie lnex lnim lnci lngp, panels(hetero),修正异方差

xtgls xtreg lngdp lnfdi lnie lnex lnim lnci lngp, panels(correlated),修正依横截面而变化的异方差

xtgls xtreg lngdp lnfdi lnie lnex lnim lnci lngp, panels(hetero) corr(ar1),修正异方差和一阶序列相关ar(1)

点击上图查看:返回搜狐,查看更多



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3