[R] Trying to predict from a time series with Additive Outliers: Error in as.matrix(newxreg) %*% coefs[-(1L:narma)] : non-conformable arguments

Andrew W. Swift swiftaw at gmail.com
Mon Jul 1 21:44:48 CEST 2013


Hi,

I am trying to work through an example in Cryer & Chan's book with regards to an ARIMA model with Interventions and Outliers

The model fit is:

m=arimax(log(airmiles),order=c(0,1,1),seasonal=list(order=c(0,1,1),period=12),xtransf=data.frame(I911=1*(seq(airmiles)==69), I911a=1*(seq(airmiles)==69)),transfer=list(c(0,0),c(1,0)),xreg=data.frame(I12=1*(seq(airmiles)==12),I25=1*(seq(airmiles)==25),I84=1*(seq(airmiles)==84)),io=c(81),method='ML')

I now want to predict from this model.  I understand that since we use xreg in the model fit, I have to specify newxreg in the predict statement.  Since xreg only contains information about additive outliers, the vectors provided in newxreg should all be zeros. 

I thus try the following

nxr=data.frame(I12=seq(0,0,length=5),I25=seq(0,0,length=5),I84=seq(0,0,length=5))
predict(m,na.ahead=5,newxreg=nxr)

But I get the following error:

Error in as.matrix(newxreg) %*% coefs[-(1L:narma)] : 
  non-conformable arguments


Any thoughts?

Thanks. 



More information about the R-help mailing list