I'm trying use expand.grid to create all combinations of 3 order parameters ranging as shown below. I'm then trying to create all models for the combinations of parameters using Arima and apply. I have pseudo code below outlining what I'm trying to do and an attempt I made below that. The attempt returned an error. If anyone can see what I'm doing wrong, point out how to fix the code, or a similar example, it would be greatly appreciated.
Pseudo Code:
library("fpp")
h <- 5
dataTraiz <- window(hsales,end=1989.99)
##Create models for all combinations of p 10 to 0, d 2 to 0, q 5 to 0
Mod1 <- Arima(dataTraiz, order=c(10,2,5)
Mod2 <- Arima(dataTraiz, order=c(9,2,5)
Mod3 <- Arima(dataTraiz, order=c(8,2,5)
.
.
.
Mod5 <- Arima(dataTraiz, order=c(10,2,0)
Attempt:
x<-1:10
y<-1:2
z<-1:5
dfG<-expand.grid(x,y,z)
n <-function(a,b,c,dat){
m=Arima(dataTraiz, order=c(a,b,c))
return(m)
}
mod<-apply(dfG,1,n)
Error:
Error in Arima(dataTraiz, order = c(a, b, c)) : argument "c" is missing, with no default