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
##请问是平稳序列吗?看哪些数值?
##如果两个结果不一样,为什么?