Learn R Programming

aTSA (version 3.1.2.1)

Winters: Winters Three-parameter Smoothing

Description

Performs Winters three-parameter smoothing for a univariate time series with seasonal pattern.

Usage

Winters(x, period = NULL, trend = 2, lead = 0, plot = TRUE,
  seasonal = c("additive", "multiplicative"), damped = FALSE, alpha = 0.2,
  beta = 0.1057, gamma = 0.07168, phi = 0.98, a.start = NA,
  b.start = NA, c.start = NA)

Value

A list with class "Winters" containing the following components:

season

the seasonal factors.

estimate

the smoothed values.

pred

the prediction, only available with lead > 0.

accurate

the accurate measurements.

Arguments

x

a univariate time series.

period

seasonal period. The default is NULL.

trend

the type of trend component, can be one of 1,2,3 which represents constant, linear and quadratic trend, respectively. The default is trend = 2.

lead

the number of steps ahead for which prediction is required. The default is 0.

plot

a logical value indicating to display the smoothed graph. The default is TRUE.

seasonal

character string to select an "additive" or "multiplicative" seasonal model. The default is "additive".

damped

a logical value indicating to include the damped trend, only valid for trend = 2. The default is FALSE.

alpha

the parameter of level smoothing. The default is 0.2.

beta

the parameter of trend smoothing. The default is 0.1057.

gamma

the parameter of season smoothing. The default is 0.07168.

phi

the parameter of damped trend smoothing, only valid for damped = TRUE. The default is 0.98.

a.start

the starting value for level smoothing. The default is NA.

b.start

the starting value for trend smoothing. The default is NA.

c.start

the starting value for season smoothing. The default is NA.

Author

Debin Qiu

Details

The Winters filter is used to decompose the trend and seasonal components by updating equations. This is similar to the function HoltWinters in stats package but may be in different perspective. To be precise, it uses the updating equations similar to exponential smoothing to fit the parameters for the following models when seasonal = "additive". If the trend is constant (trend = 1): $$x[t] = a[t] + s[t] + e[t].$$ If the trend is linear (trend = 2): $$x[t] = (a[t] + b[t]*t) + s[t] + e[t].$$ If the trend is quadratic (trend = 3): $$x[t] = (a[t] + b[t]*t + c[t]*t^2) + s[t] + e[t].$$ Here \(a[t],b[t],c[t]\) are the trend parameters, \(s[t]\) is the seasonal parameter for the season corresponding to time \(t\). For the multiplicative season, the models are as follows. If the trend is constant (trend = 1): $$x[t] = a[t] * s[t] + e[t].$$ If the trend is linear (trend = 2): $$x[t] = (a[t] + b[t]*t) * s[t] + e[t].$$ If the trend is quadratic (trend = 3): $$x[t] = (a[t] + b[t]*t + c[t]*t^2) * s[t] + e[t].$$ When seasonal = "multiplicative", the updating equations for each parameter can be seen in page 606-607 of PROC FORECAST document of SAS. Similarly, for the additive seasonal model, the 'division' (/) for \(a[t]\) and \(s[t]\) in page 606-607 is changed to 'minus' (-).

The default starting values for \(a,b,c\) are computed by a time-trend regression over the first cycle of time series. The default starting values for the seasonal factors are computed from seasonal averages. The default smoothing parameters (weights) alpha, beta, gamma are taken from the equation 1 - 0.8^{1/trend} respectively. You can also use the HoltWinters function to get the optimal smoothing parameters and plug them back in this function.

The prediction equation is \(x[t+h] = (a[t] + b[t]*t)*s[t+h]\) for trend = 2 and seasonal = "additive". Similar equations can be derived for the other options. When the damped = TRUE, the prediction equation is \(x[t+h] = (a[t] + (\phi + ... + \phi^(h))*b[t]*t)*s[t+h]\). More details can be referred to R. J. Hyndman and G. Athanasopoulos (2013).

References

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

R. J. Hyndman and G. Athanasopoulos, "Forecasting: principles and practice," 2013. [Online]. Available: http://otexts.org/fpp/.

See Also

HoltWinters, Holt, expsmooth

Examples

Run this code
Winters(co2)

Winters(AirPassengers, seasonal = "multiplicative")

Run the code above in your browser using DataLab