seasonaldummy {forecast} | R Documentation |
Returns matrix of dummy variables suitable for use in arima
,
lm
or arima.predict
.
The last season is omitted and used as the control.
seasonaldummy(x) seasonaldummyf(x,h)
x |
Seasonal time series |
h |
Number of periods ahead to forecast |
Numerical matrix with number of rows equal to the length(x)
and number of columns equal to frequency(x)-1
.
Rob J Hyndman
plot(ldeaths) plot(ldeaths) month <- seasonaldummy(ldeaths) deaths.lm <- lm(ldeaths ~ month) tsdisplay(residuals(deaths.lm)) ldeaths.fcast <- predict(deaths.lm, data.frame(month=I(seasonaldummyf(ldeaths,36))), se.fit=TRUE)