In the following result, the adf.test
shows that the series is non stationary, while ur.df
shows it is stationary (choose the lags based on decreasing from lags=5 until the lag coefficient becomes significant).
Should I trust that the series is stationary based on a=5% since the p value of z.lag.1
in ur.df
is 0.0299<0.05?
adf.test(resid(fit1), alt='s')
Augmented Dickey-Fuller Test
data: resid(fit1)
Dickey-Fuller = -1.6595, Lag order = 3, p-value = 0.7089
alternative hypothesis: stationary
summary(ur.df(resid(fit1),lags=2))
#########################################
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
-4944058 -1028037 -388697 847454 4089084
Coefficients:
Estimate Std. Error t value Pr(>|t|)
z.lag.1 -0.4614 0.2047 -2.254 0.0299 *
z.diff.lag1 -0.1785 0.1808 -0.987 0.3295
z.diff.lag2 -0.3309 0.1527 -2.167 0.0364 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1762000 on 39 degrees of freedom
Multiple R-squared: 0.4053, Adjusted R-squared: 0.3596
F-statistic: 8.86 on 3 and 39 DF, p-value: 0.0001328
Value of test-statistic is: -2.2543
Critical values for test statistics:
1pct 5pct 10pct
tau1 -2.62 -1.95 -1.61
Best Answer
The difference is due to different DF critical values. More precisely, for adf.test, the critical value is based on the model w/. drift(intercept) term while the default ur.df statistics is based on the model w/o drift(intercept) term.
You will likely see the same result if you do summary(ur.df(resid(fit1),lags=2), type='drift')