2
votes

I'm trying to fit a model to my data set using the auto.arima function but I get an error message of no suitable ARIMA model found which I suspect can be attributed to what I'm passing for the xreg portion. My data set contains 1176 total observation, including 1 variable I'm trying to forecast and the rest being dummy variables (holidays, days of the week, etc.) which I'm trying to pass into auto.arima as regressors.

library(forecast)

data <- read.csv(...)

#extract variable to be forecasted and extract regressors
forcast.var <- data[, 29]
regressors <- data[, 2:27]

#split forecast variable and regressors into train and test sets
train.r <- regressors[1:1000, ]
test.r <- regressors[1001:1176, ]

train.f <- forecast.var[1:1000]
test.f <- forecast.var[1001:1176]

#fit the data, pass 'train.r' into data.matrix and into 'xreg' since 
#documentation for this function says it must be a vector or matrix
fit <- auto.arima(train.f, stepwise = FALSE, approximation = FALSE
                  , xreg = data.matrix(train.r))

If I attempt to run this, I get the aforementioned error message. I do get a fitted model if I don't pass anything for xreg, but the fitted values or nowhere near close to the actuals. I should mention that train.r does already have column names. So what is it that I'm doing wrong? How do I successfully pass the regressors in hopes that my model comes out more accurate?

1
Most likely you have rank-deficient regressors in the xreg matrix. Perhaps too many dummy variables for the days of the week? - Rob Hyndman
@Rob Hyndman I had one dummy variable for each day of the week, including Sunday. I also had dummy variables for each month in the year, including December. I removed both columns but still get the same error message. It's probably worth mentioning that I also have a column for holidays, which I used to create a lagged version of and a lagged version of forecast.var, both of which are in train.r. - erik7970
I got same error and no clues. Do you have some update? - patL

1 Answers

0
votes

I managed to fix this by excluding one of the dummy variables. That is, for days of the week package dummies created 7 variables for me. However, if you have 7 categories only 6 dummies are needed. I excluded one and then arima worked fine.