对于包含时间序列较长的面板数据,在回归前需要进行单位根检验,否则可能存在虚假回归问题。检验方法在Stata使用手册中可以查阅得到,包括LLC检验、HT检验、Breitung检验、IPS检验、fisher 检验以及Hardri LM检验。下面具体介绍相关命令及使用方法。
**
**
webuse pennxrate,clear // 调用网页数据
describe //描述统计
*=====================================
**
note:
仅适用于长面板数据,即时间长度远大于截面个数
假定不存在截面相关,否则存在显著性扭曲,需要先去截面均值
允许不同截面内自回归系数相同
必须是平衡面板
xtunitroot llc lnrxrate , demean lags(aic 10) kernel(bartlett nwest)
option:
demean表示去截面均值
lags(
lags(aic
trend 表示加入趋势项并默认加入个体固定项
noconstant 表示趋势项与个体项都不加入
trend和noconstant都不加默认个体固定项
kernel(kernel_spec) 为核函数,估计渐进方差,具体设定包括 ba pa qu等)
结果输出:
Levin–Lin–Chu unit-root test for lnrxrate
-----------------------------------------
H0: Panels contain unit roots Number of panels = 151
Ha: Panels are stationary Number of periods = 34
AR parameter: Common Asymptotics: N/T -> 0
Panel means: Included
Time trend: Not included Cross-sectional means removed
ADF regressions: 2.18 lags average (chosen by AIC)
LR variance: Bartlett kernel, 3.50 lags average
(chosen by Newey–West)
------------------------------------------------------------------------------
Statistic p-value
------------------------------------------------------------------------------
Unadjusted t -22.1334
Adjusted t* -1.8763 0.0303
------------------------------------------------------------------------------
调整t统计量为 -1.8763 ,伴随概率 0.0303<0.05,拒绝H0: Panels contain unit roots
*=====================================
**
note:
适合于时间维度较短的微观面板数据
允许不同截面内自回归系数相同
必须是平衡面板
xtunitroot ht lnrxrate , demean
option:
trend 表示加入趋势项并默认加入个体固定项
noconstant 表示趋势项与个体项都不加入
trend和noconstant都不加默认个体固定项
demean表示去截面均值
robust:允许截面相关
lags(
结果输出:Harris-Tzavalis unit-root test for lnrxrate
-------------------------------------------
H0: Panels contain unit roots Number of panels = 151
Ha: Panels are stationary Number of periods = 34
AR parameter: Common Asymptotics: N -> Infinity
Panel means: Included T Fixed
Time trend: Not included Cross-sectional means removed
------------------------------------------------------------------------------
Statistic z p-value
------------------------------------------------------------------------------
rho 0.8184 -13.1239 0.0000
------------------------------------------------------------------------------
z = -13.1239 ,伴随概率 0.000<0.01,拒绝H0: Panels contain unit roots
*=====================================
**
option:
1)允许不同截面内自回归系数相同
2)必须是平衡面板
xtunitroot breitung lnrxrate if g7, lags(3) robust
option:
trend:加入时间趋势
noconstant : 趋势项与个体项都不加入
demean :去截面均值
robust:允许截面相关
lags(
Breitung unit-root test for lnrxrate
--------------------------------------
H0: Panels contain unit roots Number of panels = 6
Ha: Panels are stationary Number of periods = 34
AR parameter: Common Asymptotics: T,N -> Infinity
Panel means: Included sequentially
Time trend: Not included Prewhitening: 3 lags
------------------------------------------------------------------------------
Statistic p-value
------------------------------------------------------------------------------
lambda* -1.2258 0.1101
------------------------------------------------------------------------------
* Lambda robust to cross-sectional correlation
统计量 lambda* = -1.2258 伴随概率 0.1101>0.1,不拒绝H0: Panels contain unit roots
*=====================================
**
不同截面内自回归系数不同
允许非平衡
xtunitroot ips lnrxrate, lags(aic 5)
option:
trend :包含时间趋势
demean :取截面均值
lags(
结果输出:
Im–Pesaran–Shin unit-root test for lnrxrate
-------------------------------------------
H0: All panels contain unit roots Number of panels = 151
Ha: Some panels are stationary Number of periods = 34
AR parameter: Panel-specific Asymptotics: T,N -> Infinity
Panel means: Included sequentially
Time trend: Not included
ADF regressions: 1.11 lags average (chosen by AIC)
------------------------------------------------------------------------------
Statistic p-value
------------------------------------------------------------------------------
W-t-bar -15.2812 0.0000
------------------------------------------------------------------------------
Wt统计量 = -15.2812 伴随概率0.000<0.01,拒绝H0: All panels contain unit roots
*=====================================
**
不同截面内自回归系数不同
允许非平衡
xtunitroot fisher lnrxrate, dfuller lags(3) drift
option:
* dfuller :使用 ADF 单位根检验
* pperron :使用pp单位根检验
* lags(
demean 同上文
Fisher-type unit-root test for lnrxrate
Based on augmented Dickey–Fuller tests
---------------------------------------
H0: All panels contain unit roots Number of panels = 151
Ha: At least one panel is stationary Number of periods = 34
AR parameter: Panel-specific Asymptotics: T -> Infinity
Panel means: Included
Time trend: Not included
Drift term: Included ADF regressions: 3 lags
------------------------------------------------------------------------------
Statistic p-value
------------------------------------------------------------------------------
Inverse chi-squared(302) P 916.1451 0.0000
Inverse normal Z -18.8512 0.0000
Inverse logit t(759) L* -19.5571 0.0000
Modified inv. chi-squared Pm 24.9892 0.0000
------------------------------------------------------------------------------
P statistic requires number of panels to be finite.
Other statistics are suitable for finite or infinite number of panels.
------------------------------------------------------------------------------
上述逆卡方、逆正态、逆逻辑以及修正逆卡方统计量伴随概率均为0.000<0.01,故
拒绝H0: All panels contain unit roots
*=====================================
**
xtunitroot hadri lnrxrate, kernel(parzen 5)
option作用同上文相关检验
trend include a time trend
demean subtract cross-sectional means
robust allow for cross-sectional dependence
kernel(kernel_spec) specify method to estimate long-run varianc
更多内容help xtunitroot
-END-
面板数据单位根检验是用来检验面板数据中变量是否具有单位根的统计方法。在Stata中,可以使用xtunitroot命令进行面板数据单位根检验。
xtunitroot命令的基本语法如下:
xtunitroot depvar [indepvars] [if] [in] [, options]
其中,depvar是要进行单位根检验的变量,indepvars是用来解释depvar的自变量。options是可选的参数,用于指定检验方法和其他设置。
常用的选项包括:
- lags(n):指定滞后阶数,默认为4。
- trend:添加趋势项。
- testtype(type):指定检验类型,常用的有ADF(Augmented Dickey-Fuller)和PP(Phillips-Perron)。
- panelvar(varname):指定面板变量,用于进行面板数据单位根检验。
下面是一个示例:
xtunitroot y x1 x2, lags(2) trend testtype(ADF) panelvar(id)
这个命令将对变量y进行面板数据单位根检验,使用x1和x2作为解释变量,滞后阶数为2,添加趋势项,并使用ADF检验方法。面板变量id用于进行面板数据单位根检验。