Winters | R Documentation |
Performs Winters three-parameter smoothing for a univariate time series with seasonal pattern.
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)
x |
a univariate time series. |
period |
seasonal period. The default is |
trend |
the type of trend component, can be one of 1,2,3 which represents constant,
linear and quadratic trend, respectively. The default is |
lead |
the number of steps ahead for which prediction is required.
The default is |
plot |
a logical value indicating to display the smoothed graph. The default is
|
seasonal |
character string to select an " |
damped |
a logical value indicating to include the damped trend, only valid for
|
alpha |
the parameter of level smoothing. The default is |
beta |
the parameter of trend smoothing. The default is |
gamma |
the parameter of season smoothing. The default is |
phi |
the parameter of damped trend smoothing, only valid for |
a.start |
the starting value for level smoothing. The default is |
b.start |
the starting value for trend smoothing. The default is |
c.start |
the starting value for season smoothing. The default is |
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).
A list with class "Winters
" containing the following components:
season |
the seasonal factors. |
estimate |
the smoothed values. |
pred |
the prediction, only available with |
accurate |
the accurate measurements. |
The sum of seasonal factors is equal to the seasonal period. This restriction is to ensure the identifiability of seasonality in the models above.
Debin Qiu
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/.
HoltWinters
, Holt
, expsmooth
Winters(co2)
Winters(AirPassengers, seasonal = "multiplicative")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.