forecast (version 2.09)

seasonaldummy: Seasonal dummy variables

Description

Returns matrix of dummy variables suitable for use in arima or lm. 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.

Examples

Run this code
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)

Run the code above in your browser using DataCamp Workspace