Reputation: 2049
I'm trying to use an ARIMA model in R to forecast data. A slice of my time series looks like this:
This is just a slice of time for you get a sense of it. I have daily data from 2010 to 2015.
I want to forecast this into the future. I'm using the forecast
library, and my code looks like this:
dt = msts(data$val, seasonal.periods=c(7, 30))
fit = auto.arima(dt)
plot(forecast(fit, 300))
This results in:
This model isn't good or interesting. My seasonal.periods
were defined by me because I expect to see weekly and monthly seasonality, but the result looks the same with no seasonal periods defined.
Am I missing something? Very quickly the forecast predictions change very, very little from point to point.
Edit:
To further show what I'm talking about, here's a concrete example. Let's say I have the following fake dataset:
x = 1:500
y = 0.5*c(NA, head(x, -1)) - 0.4*c(NA, NA, head(x, -2)) + rnorm(500, 0, 5)
This is an AR(2) model with coefficients 0.5
and 0.4
. Plotting this time series yields:
So I create an ARIMA model of this and plot the forecast results:
plot(forecast(auto.arima(y), 300))
And the results are:
Why can't the ARIMA function learn this obvious model? I don't get any better results if I use the arima
function and force it to try an AR(2) model.
Upvotes: 1
Views: 584
Reputation: 31820
auto.arima
does not handle multiple seasonal periods. Use tbats
for that.
dt = msts(data$val, seasonal.periods=c(7, 30))
fit = tbats(dt)
plot(forecast(fit, 300))
auto.arima
will just use the largest seasonal period and try to do the best it can with that.
Upvotes: 1