1

I have to test if a time series is stationary and to this end I have performed some unit root tests. I tried different functions, here the results.

adf <- ur.df(Series$count, type='trend', lags=5)
summary(adf)

############################################### 
# Augmented Dickey-Fuller Test Unit Root Test # 
############################################### 

Test regression trend 


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

Residuals:
    Min      1Q  Median      3Q     Max 
-7.2957 -1.9431 -0.3241  1.6033 14.6792 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)  1.3928564  0.1528018   9.115  < 2e-16 ***
z.lag.1     -0.8214599  0.0506703 -16.212  < 2e-16 ***
tt           0.0022045  0.0001759  12.532  < 2e-16 ***
z.diff.lag1  0.0802531  0.0449501   1.785   0.0744 .  
z.diff.lag2 -0.0233154  0.0392267  -0.594   0.5523    
z.diff.lag3 -0.0836200  0.0334461  -2.500   0.0125 *  
z.diff.lag4 -0.1520560  0.0274939  -5.531 3.62e-08 ***
z.diff.lag5 -0.2275768  0.0220292 -10.331  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 2.802 on 1963 degrees of freedom
Multiple R-squared:  0.4322,    Adjusted R-squared:  0.4302 
F-statistic: 213.5 on 7 and 1963 DF,  p-value: < 2.2e-16


Value of test-statistic is: -16.2119 87.6104 131.4153 

Critical values for test statistics: 
      1pct  5pct 10pct
tau3 -3.96 -3.41 -3.12
phi2  6.09  4.68  4.03
phi3  8.27  6.25  5.34

erf <- ur.ers(Series$count, c("DF-GLS"), model = c("trend"),
              lag.max = 5)
summary(erf)

############################################### 
# Elliot, Rothenberg and Stock Unit Root Test # 
############################################### 

Test of type DF-GLS 
detrending of series with intercept and trend 


Call:
lm(formula = dfgls.form, data = data.dfgls)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.5455 -1.4909  0.1633  2.0199 15.2006 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
yd.lag       -0.59178    0.04367 -13.552  < 2e-16 ***
yd.diff.lag1 -0.10358    0.04013  -2.581  0.00993 ** 
yd.diff.lag2 -0.17355    0.03566  -4.866 1.23e-06 ***
yd.diff.lag3 -0.19873    0.03114  -6.382 2.18e-10 ***
yd.diff.lag4 -0.23188    0.02631  -8.814  < 2e-16 ***
yd.diff.lag5 -0.27383    0.02173 -12.601  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 2.852 on 1965 degrees of freedom
Multiple R-squared:  0.4112,    Adjusted R-squared:  0.4094 
F-statistic: 228.7 on 6 and 1965 DF,  p-value: < 2.2e-16


Value of test-statistic is: -13.5524 

Critical values of DF-GLS are:
                 1pct  5pct 10pct
critical values -3.48 -2.89 -2.57

> adf.test(x=Series$count, k=5)

    Augmented Dickey-Fuller Test

data:  Series$count
Dickey-Fuller = -16.212, Lag order = 5, p-value = 0.01
alternative hypothesis: stationary

Warning message:
In adf.test(x = Series$count, k = 5) : p-value smaller than printed p-value

It seems to me that according the first two tests I can conclude that the series is non-stationary([[1] -16 < -3.96; [2] -13<-3.4) , while the third ([3] p-value<0.01) provide strong evidence of stationarity (despite, clearly the first and the third should be exactly the same: they are both ADF test with drift and trend with 5 lags).

Can anyone explain me what I am getting wrong here?

Thanks a lot.

pietrosan
  • 53
  • 3
  • Are you sure the last one has both drift and trend? – Richard Hardy Jul 08 '21 at 07:59
  • My understanding, reading the documentation of the function (https://www.rdocumentation.org/packages/aTSA/versions/3.1.2/topics/adf.test), is that it automatically select the most appropriate specification. And it is seems to me that this is confirmed also here https://nwfsc-timeseries.github.io/atsa-labs/sec-boxjenkins-aug-dickey-fuller.html where the Author says that "The ur.df() Augmented Dickey-Fuller test in the urca package gives us a bit more information on and control over the test". However, I am not sure. – pietrosan Jul 09 '21 at 13:10
  • Looking at the help file of the function `adf.test`, it seems all three specifications should be reported, but I do not see that in your output. I do not see that the selection between the three specifications is made automatically either. – Richard Hardy Jul 09 '21 at 15:21
  • If it is the case I do not know how and it is the reason why I concluded that it automatically select the most appropriate. Now I made some other research (https://stats.stackexchange.com/questions/131148/the-difference-between-the-three-augmented-dickey-fuller-test-none-drift-trend/131244) and I found that the function uses only the specification with interecpt and trend. – pietrosan Jul 09 '21 at 16:32

0 Answers0