Hi @gueyenono, thank you for your reply. Indeed, i am familiar with the statistical test. My overall problem is that i have a time series which is clearly nonstationary, with quite a high degree of autocorrelation. Hence, I thought I would do multiple ADF tests and then compare them using AIC, so as to establish the order of integration of the data, which is where I am struggling in a very pragmatic sense. I have realized there are multiple packages to do ADF tests in R (aTSA, tseries, urca, MultipleBubbles). Let me summarize them below.
library(tseries)
adf.test(US1ytimeseries[,2], k=5)
with the output being:
Augmented Dickey-Fuller Test
data: US1ytimeseries[, 2]
Dickey-Fuller = -3.02, Lag order = 5, p-value = 0.1505
alternative hypothesis: stationary
Here, my understanding is that we fail to reject the null hypothesis (at multiple confidence levels) and conclude that the time series is nonstationary. Could we infer anything else from this?
If instead I use the package tseries, I get the following:
library(aTSA)
adf.test(US1ytimeseries[,2], nlag = 5)
with the output being:
Augmented Dickey-Fuller Test
alternative: stationary
Type 1: no drift no trend
lag ADF p.value
[1,] 0 -0.101 0.614
[2,] 1 -0.226 0.579
[3,] 2 -0.356 0.541
[4,] 3 -0.677 0.437
[5,] 4 -0.907 0.354
Type 2: with drift no trend
lag ADF p.value
[1,] 0 -2.24 0.2361
[2,] 1 -2.77 0.0704
[3,] 2 -2.91 0.0486
[4,] 3 -3.63 0.0100
[5,] 4 -4.06 0.0100
Type 3: with drift and trend
lag ADF p.value
[1,] 0 -2.14 0.5150
[2,] 1 -2.67 0.2951
[3,] 2 -2.75 0.2604
[4,] 3 -3.40 0.0557
[5,] 4 -3.67 0.0293
----
Note: in fact, p.value = 0.01 means p.value <= 0.01
This is where it gets a little bit trickier: I understand the difference between the three models, but how to intepret it in this case? And what about the different lags? I do not seem to find any guide to the package interpretation online.
Then, given that my old interest is in identifying the order of autocorrelation, I noticed that with the package MultipleBubbles I could do ADF and AIC at once. Hence:
library(MultipleBubbles)
ADF_IC(US1ytimeseries[,2], adflag = 12, mflag = 1, IC = 1)
#Notice I used mflag=1 suspecting there is a constat term in the ADF)
with output:
$`ADF Statistic using AIC`
[1] -2.236572
Now, I am very much not sure how to intepret "[1]" in this case, and I have not found anything useful online.
Finally, I have tried the package urca. Hence,
l> ibrary(urca)
interp_urdf <- function(urdf, level="5pct") {code taken by Hank Roark github }
dmeanUS1ytimeseries <- diff(US1ytimeseries[,2], lag = 1, differences = 1)
#========================================================
ADF test of level variables
#========================================================
Level
adf.t.n = ur.df(US1ytimeseries[,2], type ="none" , selectlags = c("AIC"))
adf.t.d = ur.df(US1ytimeseries[,2], type = "drift", selectlags = c("AIC"))
adf.t.t = ur.df(US1ytimeseries[,2], type="trend", selectlags = c("AIC"))
1st difference
adf.d.n = ur.df(dmeanUS1ytimeseries, type="none" , selectlags = c("AIC"))
adf.d.d = ur.df(dmeanUS1ytimeseries, type="drift", selectlags = c("AIC"))
adf.d.t = ur.df(dmeanUS1ytimeseries, type="trend", selectlags = c("AIC"))
#========================================================
Automatic Interpretation by using Hank Roark procedure
#========================================================
Level
interp_urdf(adf.t.n, "5pct")
interp_urdf(adf.t.d, "5pct")
interp_urdf(adf.t.t, "5pct")
1st difference
interp_urdf(adf.d.n, "5pct")
interp_urdf(adf.d.d, "5pct")
interp_urdf(adf.d.t, "5pct")
with output:
===================================================
At the 5pct level:
The model is of type none
tau1: The null hypothesis is not rejected, unit root is present
====================================================
interp_urdf(adf.t.d, "5pct")
======================================================
At the 5pct level:
The model is of type drift
tau2: The first null hypothesis is not rejected, unit root is present
phi1: The second null hypothesis is not rejected, unit root is present
and there is no drift.
=======================================================
interp_urdf(adf.t.t, "5pct")
=======================================================
At the 5pct level:
The model is of type trend
tau3: The first null hypothesis is not rejected, unit root is present
phi3: The second null hypothesis is not rejected, unit root is present
and there is no trend
phi2: The third null hypothesis is not rejected, unit root is present
there is no trend, and there is no drift
========================================================================
adf.d.n = ur.df(dmeanUS1ytimeseries, type="none" , selectlags = c("AIC"))
adf.d.d = ur.df(dmeanUS1ytimeseries, type="drift", selectlags = c("AIC"))
adf.d.t = ur.df(dmeanUS1ytimeseries, type="trend", selectlags = c("AIC"))
interp_urdf(adf.d.n, "5pct")
========================================================================
At the 5pct level:
The model is of type none
tau1: The null hypothesis is rejected, unit root is not present
========================================================================
interp_urdf(adf.d.d, "5pct")
========================================================================
At the 5pct level:
The model is of type drift
tau2: The first null hypothesis is rejected, unit root is not present
phi1: The second null hypothesis is rejected, unit root is not present
and there is drift.
========================================================================
interp_urdf(adf.d.t, "5pct")
=======================================================================
At the 5pct level:
The model is of type trend
tau3: The first null hypothesis is rejected, unit root is not present
phi3: The second null hypothesis is rejected, unit root is not present
and there may or may not be trend
phi2: The third null hypothesis is rejected, unit root is not present
there may or may not be trend, and there may or may not be drift
========================================================================
Warning messages:
1: In interp_urdf(adf.d.t, "5pct") : Presence of trend is inconclusive.
2: In interp_urdf(adf.d.t, "5pct") :
Presence of trend and drift is inconclusive.
Hence my understanding is that given that the first-differenced time series is stationary the overall time series is AR(1). Now my question is, how can I prove this formally?