I am trying to extract AICs & BICs from an ARIMA estimation with different combinations of p & q (p=0,1,2,3 and q=0,1.2,3). I have tried using the following code, unsucessfully.
code: storage1 <- numeric(16) for (p in 0:3){
> for (q in 0:3){
>
> storage1[p] <- arima(x,order=c(p,0,q), method="ML")} } storage1$aic
One way is to use expand.grid() to get all combinations of p and q, and apply them to your arima model, i.e.
apply(expand.grid(p, q), 1, function(i) arima(d1$cnt, order = c(i[1], 0, i[2]), method = "ML")$aic)
#[1] 47222.43 38589.14 36935.33 36118.44 42569.73 35183.35 35141.13 35143.02 39448.38 35142.96 35142.58 35142.60
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With