用adf.test()得到的结果:
> adf.test(nngdp$d)
Augmented Dickey-Fuller Test
data: nngdp$d
Dickey-Fuller = -3.3838, Lag order = 3, p-value =
0.07831
alternative hypothesis: stationary
> adf.test(nngdp$d2)
Augmented Dickey-Fuller Test
data: nngdp$d2
Dickey-Fuller = -3.7696, Lag order = 3, p-value =
0.03643
alternative hypothesis: stationary
这里有几点要说明:首先这个就是adf.test()的P值是可以直接用来判断的,因为这个是用插值得到的结果。我截取adf.test()的源代码做一个分析:
if(k > 1) {
yt1 <- z[,2:k]
res <- lm(yt ~ xt1 + 1 + tt + yt1)
}
else
res <- lm(yt ~ xt1 + 1 + tt)
res.sum <- summary(res)
STAT <- res.sum$coefficients[2,1] / res.sum$coefficients[2,2]
table <- cbind(c(4.38, 4.15, 4.04, 3.99, 3.98, 3.96),
c(3.95, 3.80, 3.73, 3.69, 3.68, 3.66),
c(3.60, 3.50, 3.45, 3.43, 3.42, 3.41),
c(3.24, 3.18, 3.15, 3.13, 3.13, 3.12),
c(1.14, 1.19, 1.22, 1.23, 1.24, 1.25),
c(0.80, 0.87, 0.90, 0.92, 0.93, 0.94),
c(0.50, 0.58, 0.62, 0.64, 0.65, 0.66),
c(0.15, 0.24, 0.28, 0.31, 0.32, 0.33))
table <- -table
tablen <- dim(table)[2]
tableT <- c(25, 50, 100, 250, 500, 100000)
tablep <- c(0.01, 0.025, 0.05, 0.10, 0.90, 0.95, 0.975, 0.99)
tableipl <- numeric(tablen)
for(i in (1:tablen))
tableipl <- approx(tableT, table[, i], n, rule=2)$y(这里是根据不同样本数对临界值进行插值调整)
interpol <- approx(tableipl, tablep, STAT, rule=2)$y(这里是根据统计量的值在临界值中的位置,利用插值的方法计算出对应的概率值)
因此adf.test()的p值并不是我们一般OLS得到的P值结果。如需要详细了解,可阅读enders的《时间序列分析》。
2.对于adf.test(),需要注意的是:首先,它的模型假设就是一种,带趋势的模型。其次,它默认的滞后阶数是3阶。