I am trying to check multiple time series on their optimal lag using VARselect(table$column,lag.max = 10,type="both")
and using different values for lag.max
.
My advisor told me, I should use a for loop and just store the output values to later find the best fitting value for lag.max
.
This is what I tried so far:
for (i in 1:10){
AIC_list[i]=VARselect(table$column, lag.max = i, type = c("const", "trend", "both", "none"), season = NULL, exogen = NULL)
}
However, I get the error: Fehler in embed(y, lag) : wrong embedding dimension
.
Does anybody know, how I can build the loop correctly?
Thank you very much!