title: Error with forecast.Arima with xreg
body: <p>I am trying to fit a regression model with ARMA errors using the arima() and forecast.Arima() functions in the forecast library.  (i.e. the closest thing to an ARMAX model that I can fit using the arima() function)</p>
  
  <p>My code:</p>
  
  <hr>
  
  <pre><code>library(forecast)
  data &lt;-read.csv(filename,stringsAsFactors=FALSE)
  data.ts&lt;-ts(data$result,frequency=24,start=c(1,1),end=c(7,24))
  input.ts&lt;-ts(data$input,frequency=24,start=c(1,1),end=c(7,24))
  data.fit &lt;- arima(window(data.ts,start=c(1,1),end=c(5,24)), 
                    order=c(2,0,3), seasonal =list(order = c(1, 0, 1), period = 24),      
                    xreg=window(input.ts,start=c(1,1),end=c(5,24)))
  data.forecast &lt;-forecast.Arima(data.fit,
                                 xreg=window(input.ts,start=c(6,1),end=c(7,24)))
  </code></pre>
  
  <p>However, I get the following error when including the xreg factor in the forecast.Arima() function:</p>
  
  <pre><code>Error in if (ncol(xreg) != ncol(object$call$xreg)) 
  stop("Number of regressors does not match fitted model") : 
  argument is of length zero
  </code></pre>
  
  <p>I don't understand why I get this error.  I have included the future values of xreg in forecast.Arima() function, and the input time series is the exact same in the arima() function, just at a different window.  </p>
  
  <p>What should be the type of xreg?  I have tried coercing the xreg time series object into a data frame and numeric vector with no success.</p>