I am trying to use Auto Arima function for 70 variables. For it I need to create time series 70 times.
dealer1 <- ts(tier2[,2], start=c(2015,8), end = c(2018,12), frequency=12)
dealer2 <- ts(tier2[,3], start=c(2015,8), end = c(2018,12), frequency=12)
dealer3 <- ts(tier2[,4], start=c(2015,8), end = c(2018,12), frequency=12)..and so on.
And then I need to use the Auto Arima function again for 70 variables.
automatic.dealer1 = auto.arima(dealer1, ic = "aicc")
automatic.dealer2 = auto.arima(dealer2, ic = "aicc")
automatic.dealer3 = auto.arima(dealer3, ic = "aicc")... and so on
And then forecast the output:
forecast.dealer1 = forecast(automatic.dealer1, h = 3)$mean
forecast.dealer2 = forecast(automatic.dealer2, h = 3)$mean
forecast.dealer3 = forecast(automatic.dealer3, h = 3)$mean
I am trying to use the for loop in R, but I am getting an error. What am I doing wrong??
k <- 1
l <- 2
for(i in seq(1,70)){
dealer[k] <- ts(dealer1[,l], start=c(2015,8), end = c(2018,12), frequency=12)
dealer[k]
automatic <- auto.arima(dealer.[k], ic = "aicc")
foreArima <- forecast(automatic, h=3)
automatic
foreArima
k <- k+1
l <- l+1
}
I need the ARIMA model selected for all the 70 variables I have in my data plus the forecast for each one of them to be displayed
Data sample looks like: