Not sure this has been asked before exactly but I have a bunch of coefficient tests for many different models:
coeftest(arima(detrend, order = c(0,0,2))) #MA2
coeftest(arima(detrend, order = c(0,0,3))) #MA3
coeftest(arima(detrend, order = c(0,0,4))) #MA4
coeftest(arima(detrend, order = c(1,0,0))) #AR1
coeftest(arima(detrend, order = c(2,0,0))) #AR2
coeftest(arima(detrend, order = c(1,0,1))) #ARMA(1,1)
coeftest(arima(detrend, order = c(2,0,1))) #ARMA(2,1)
coeftest(arima(detrend, order = c(2,0,1))) #ARMA(1,2)
How would I make a nice table where I can have the model/object name if I store those tests in objects and the resulting time series estimates with their p-values? Something like:
Model AR Terms MA Terms P-value
MA1 NA 1 0.006
AR2 1 NA 0.0042
2 NA 0.0020
ARMA11 1 0 0.0031
0 1 0.0005
Any arima model will do for a sample, so I will provide this ar2 process:
phi.1 <- 1.2
phi.2 <- -0.6
sigma.e <- 9
Y <- rnorm(2, 0, sigma.e)
n <- 200
for(t in 3:(n+2)){
new <- phi.1*(Y[t-1]) + phi.2*(Y[t-2]) + rnorm(1, 0, sigma.e)
Y <- c(Y, new)
}
ar2 <- as.ts(Y)