title: From Auto.arima to forecast in R
body: <p>I don't quite understand the syntax of how <code>forecast()</code> applies external regressors in the <code>library(forecast)</code> in <code>R</code>.</p>
  
  <p>My fit looks like this:</p>
  
  <p><code>fit &lt;- auto.arima(Y,xreg=factors)</code></p>
  
  <p>where <code>Y</code> is a <code>timeSeries</code> object 100 x 1 and factors is a <code>timeSeries</code> object 100 x 5.</p>
  
  <p>When I go to forecast, I apply...</p>
  
  <p><code>forecast(fit, h=horizon)</code></p>
  
  <p>And I get an error: </p>
  
  <p><code>Error in forecast.Arima(fit, h = horizon) : No regressors provided</code></p>
  
  <p>Does it want me to add back the xregressors from the fit?  I thought these were included in the <code>fit</code> object as <code>fit$xreg</code>.  Does that mean it's asking for future values of the xregressors, or that I should repeat the same values I used in the fit set?  The documentation doesn't cover the meaning of <code>xreg</code> in the forecast step.</p>
  
  <p>I believe all this means I should use</p>
  
  <p><code>forecast(fit, h=horizon,xreg=factors)</code></p>
  
  <p>or</p>
  
  <p><code>forecast(fit, h=horizon,xreg=fit$xreg)</code></p>
  
  <p>Which gives the same results.  But I'm not sure whether the forecast step is interpreting the factors as future values, or appropriately as previous ones.  So,</p>
  
  <ol>
  <li>Is this doing a forecast out of purely past values, as I expect?</li>
  <li>Why do I have to specify the xreg values twice?  It doesn't run if I exclude them, so it doesn't behave like an option.</li>
  </ol>