langfz98
langfz98
2017-12-23 11:17

R语言如何看adf.test和ur.df两个函数检验序列平稳性的结论。求指教!

5
  • 向量自回归
  • 时间序列预测
  • r语言
  • 统计学
  • 序列平稳性

library(tseries)
library(forecast)
library(urca)
library(vars)

set.seed(12345)
u<-rnorm(500)
x<-cumsum(u)
y<-x+u
##如果用adf.test
adf.test(y)
##结果是:
Augmented Dickey-Fuller Test

data: y
Dickey-Fuller = -2.5536, Lag order = 7, p-value = 0.344
alternative hypothesis: stationary
##请问是平稳序列吗??看哪些数值?

##对同一个序列,如果用ur.df
summary(ur.df(y))
##结果是
###############################################

Augmented Dickey-Fuller Test Unit Root Test #

###############################################

Test regression none

Call:
lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)

Residuals:
Min 1Q Median 3Q Max
-5.5235 -1.3095 0.0289 1.4407 5.4889

Coefficients:
Estimate Std. Error t value Pr(>|t|)

z.lag.1 0.0007778 0.0028307 0.275 0.784

z.diff.lag -0.3831155 0.0415501 -9.221 <2e-16 ***

Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 2.051 on 496 degrees of freedom
Multiple R-squared: 0.1464, Adjusted R-squared: 0.143
F-statistic: 42.54 on 2 and 496 DF, p-value: < 2.2e-16

Value of test-statistic is: 0.2748

Critical values for test statistics:
1pct 5pct 10pct
tau1 -2.58 -1.95 -1.62
##请问是平稳序列吗?看哪些数值?
##如果两个结果不一样,为什么?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换