robjhyndman / forecast

Forecasting Functions for Time Series and Linear Models
http://pkg.robjhyndman.com/forecast
1.12k stars 342 forks source link

auto.arima does not allow for constant? #341

Closed Stefan2015-5 closed 8 years ago

Stefan2015-5 commented 8 years ago

The Arima command allows for a constant, while the auto.arima does not seem so. In the example below the comovement between y and x is very weak but auto.arima forces the regression through the origin for some reason:

#some data
y<-c( 670 ,610, 561, 808 ,459)
xreg1<- c(85, -53, -160, -167, -890)
xreg2<- c(227,  160,  -40,  -51, -503)

# using auto.arima
f<-auto.arima(y, xreg=cbind(xreg1,xreg2))
new.xreg2<- matrix(-503, ncol=2, nrow=8) 
plot(forecast.Arima(f, new.xreg, xreg=new.xreg2    )) 

# using Arima and setting include.constant=TRUE
f2<-Arima(y,  xreg=cbind(xreg1,xreg2), include.constant = TRUE     )
plot(forecast.Arima(f2, new.xreg, xreg=new.xreg2    )) 
robjhyndman commented 8 years ago

auto.arima allows for a constant, but chooses not to include one for this model.