This help topic is for R version 1.5.0. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/ts/html/HoltWinters.html
HoltWinters {ts}R Documentation

Holt-Winters Filtering

Description

Computes Holt-Winters Filtering of a given time series. Unknown parameters are determined by minimizing the squared prediction error.

Usage

HoltWinters(x, alpha = NULL, beta = NULL, gamma = NULL,
          seasonal = "additive", start.periods = 3,
          l.start = NULL, b.start = NULL, s.start = NULL)

Arguments

x

An object of class ts

alpha

alpha parameter of Holt-Winters Filter

beta

beta parameter of Holt-Winters Filter. If set to 0, the function will do exponential smoothing.

gamma

gamma parameter used for the seasonal component. If set to 0, an non-seasonal model is fitted.

seasonal

Selects an "additive" or "multiplicative" seasonal model. (Only takes effect if gamma is non-zero).

start.periods

Start periods used in the autodetection of start values. Must be at least 3.

l.start

Start value for level (a[0]).

b.start

Start value for trend (b[0]).

s.start

Vector of start values for the seasonal component (s_1[0]...s_p[0])

Details

The additive Holt-Winters prediction function (for time series with period length p) is

\hat Y[t+h] = a[t] + h b[t] + s[t + 1 + (h - 1) \bmod p],

where a[t], b[t] and s[t] are given by

a[t] = \alpha (Y[t] - s[t-p]) + (1-\alpha) (a[t-1] + b[t-1])

b[t] = \beta (a[t] -a[t-1]) + (1-\beta) b[t-1]

s[t] = \gamma (Y[t] - a[t]) + (1-\gamma) s[t-p]

The multiplicative Holt-Winters prediction function (for time series with period length p) is

\hat Y[t+h] = (a[t] + h b[t]) \times s[t + 1 + (h - 1) \bmod p].

where a[t], b[t] and s[t] are given by

a[t] = \alpha (Y[t] / s[t-p]) + (1-\alpha) (a[t-1] + b[t-1])

b[t] = \beta (a[t] - a[t-1]) + (1-\beta) b[t-1]

s[t] = \gamma (Y[t] / a[t]) + (1-\gamma) s[t-p]

The function tries to find the optimal values of \alpha and/or \beta and/or \gamma by minimizing the squared one-step prediction error if they are omitted.

Start values for a, b and s are detected by performing a simple decomposition in trend and seasonal component using moving averages (see function decompose) on the start.periods first periods (a simple linear regression on the trend component is used for starting level and trend.)

Value

An object of class "HoltWinters", a list with components:

fitted

The filtered time series

x

The original series

alpha

alpha used for filtering

beta

beta used for filtering

(gamma)gamma used for filtering \itemcoefficientsA vector with named components a, b, s1, ..., sp containing the estimated values for the level, trend and seasonal components \itemseasonalThe specified seasonal-parameter \itemSSEThe final sum of squared errors achieved in optimizing \itemcallThe call used

Author(s)

David Meyer david.meyer@ci.tuwien.ac.at

References

C.C Holt (1957) Forecasting seasonals and trends by exponentially weighted moving averages, ONR Research Memorandum, Carnigie Institute 52.

P.R Winters (1960) Forecasting sales by exponentially weighted moving averages, Management Science 6, 324–342.

See Also

predict.HoltWinters

Examples

library(ts)
data(co2)


(m <- HoltWinters(co2))
plot(m)

data(AirPassengers)
(m <- HoltWinters(AirPassengers, seasonal = "mult"))
plot(m)


data(uspop)
x <- uspop + rnorm(uspop, sd = 5)
m <- HoltWinters(x, gamma = 0)
plot(m)


m2 <- HoltWinters(x, gamma = 0, beta = 0)
lines(fitted(m2), col = 3)