I'm dealing with the following problem right now: I'm going through Data Smart Forecasting example with this data set:
library(forecast)
mydata <- c(165, 171, 147, 143, 164, 160, 152, 150, 159, 169, 173, 203, 169, 166, 162, 147, 188, 161, 162, 169, 185, 188, 200, 229, 189, 218, 185, 199, 210, 193, 211, 208, 216, 218, 264, 304)
mydata.ts <- ts(mydata, frequency = 12, start = c(2010, 1))
mydata.forecast <- forecast(mydata.ts)
plot(mydata.forecast)
With this code, I produce a Holt-Winters Forecast, just like the book says. Now I was wondering I could forecast month #36 (value = 304) by only using 35 previous observations.
mydata1 <- c(165, 171, 147, 143, 164, 160, 152, 150, 159, 169, 173, 203, 169, 166, 162, 147, 188, 161, 162, 169, 185, 188, 200, 229, 189, 218, 185, 199, 210, 193, 211, 208, 216, 218, 264)
mydata1.ts <- ts(mydata1, frequency = 12, start = c(2010, 1))
mydata1.forecast <- forecast(mydata1.ts)
plot(mydata1.forecast)
This does not produce a forecast with trend and seasonality, but a simple constant level forecast.
mydata1.forecast$mean
Jan Feb Mar Apr May Jun Jul Aug
2012
2013 239.1952 239.1952 239.1952 239.1952 239.1952 239.1952 239.1952 239.1952
2014 239.1952 239.1952 239.1952 239.1952 239.1952 239.1952 239.1952 239.1952
Sep Oct Nov Dec
2012 239.1952
2013 239.1952 239.1952 239.1952 239.1952
2014 239.1952 239.1952 239.1952
I have an intuition that cutting a time series such that
elements in time series / modulo 12 != 0
results in a falsified forecast. But how could I overcome this problem?
I also tried to cut the first 11 observations so that the time series contains 24 elements
mydatacut <- c(203, 169, 166, 162, 147, 188, 161, 162, 169, 185, 188, 200, 229, 189, 218, 185, 199, 210, 193, 211, 208, 216, 218, 264)
mydatacut.ts <- ts(mydatacut, frequency = 12, start = c(2010, 1))
mydatacut.forecast <- forecast(mydatacut.ts)
plot(mydatacut.forecast)
mydatacut.forecast$mean
Jan Feb Mar Apr May Jun Jul Aug Sep
2012 240.437 240.437 240.437 240.437 240.437 240.437 240.437 240.437 240.437
2013 240.437 240.437 240.437 240.437 240.437 240.437 240.437 240.437 240.437
Oct Nov Dec
2012 240.437 240.437 240.437
2013 240.437 240.437 240.437
So this does not help either.
Every hint and suggestion is highly appreciated.