seasonaldummy {forecast}R Documentation

Seasonal dummy variables

Description

Returns matrix of dummy variables suitable for use in arima, lm or arima.predict. The last season is omitted and used as the control.

Usage

seasonaldummy(x)
seasonaldummyf(x,h)

Arguments

x Seasonal time series
h Number of periods ahead to forecast

Value

Numerical matrix with number of rows equal to the length(x) and number of columns equal to frequency(x)-1.

Author(s)

Rob J Hyndman

Examples

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)

[Package forecast version 1.23 Index]