Suppose that I have the following "for" loop in R.
USDlogreturns=diff(log(prices))
for(i in 0:5){
for(j in 0:5){
fit <- arima(USDlogreturns, order=c(i,0,j), include.mean=TRUE)
}
}
How do you tell R to substitute a NA matrix with the coefficients of all the estimated models?
You will need a matrix
M
with dimensions 36 times 13. Then useThe columns 2 to 6 will contain AR coefficients.
The columns 8 to 12 will contain MA coefficients.
The 13th column will contain the "intercepts" (actually, the means, as the terminology in the
arima
function is misleading).