I'm modelling with the fpp2 package's data set uschange and the vars package's Augmented Dickey-Fuller unit root test (ADF test). I have five series with the designations "Consumption," "Income," "Production," "Savings," and "Unemployment" in this example. The following is the code:
#CODE
library(fpp2)
library(vars)
#CODE
library(fpp2)
library(vars)
MY DATA<-data.frame(uschange)
MY ADF TESTS=apply(MY DATA,2,function(x){
return(
list(
#Constant
summary(ur.df(x, type = "drift", selectlags = c("BIC")), summary(ur.df(x, type = "drift"), summary(ur.df(x, type = "drift"), summary(ur.df(x
summary(ur.df(diff(x), type = "drift", selectlags = c("BIC")), summary(ur.df(diff(x), type = "drift"), summary(ur.df(diff(x), type = "drift"), summary(ur.d
#Trend
#Constant
summary(ur.df(x, type = "trend", selectlags = c("BIC")), summary(ur.df(x, type = "trend"), summary(ur.df(x, type = "trend"), summary(ur.df(x,
summary(ur.df(diff(x), type = "trend", selectlags = c("BIC"))) summary(ur.df(diff(x), type = "trend", selectlags = c("BIC")) summary(ur.df(diff(x),
#summary(ur.df(x, type = "none",selectlags = c("BIC")) ur.df(x, type = "none",selectlags = c("BIC")) ur.df(x, type = "none
)
)
})
The following is the list's structure:
fill in the blanks with the image's description
fill in the blanks with the image's description
As a result, the next step is to extract test statistics and critical values from each series in this list and enter them into a table. This is where you may find test statistics and crucial values.