Winters: Winters Three-parameter Smoothing

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

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

Usage

1
2
3
4
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)

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.

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] + (φ + ... + φ^(h))*b[t]*t)*s[t+h]. More details can be referred to R. J. Hyndman and G. Athanasopoulos (2013).

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.

Note

The sum of seasonal factors is equal to the seasonal period. This restriction is to ensure the identifiability of seasonality in the models above.

Author(s)

Debin Qiu

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

1
2
3
Winters(co2)

Winters(AirPassengers, seasonal = "multiplicative")

Example output

Attaching package: 'aTSA'

The following object is masked from 'package:graphics':

    identify

$season
        1         2         3         4         5         6         7         8 
0.9981524 1.0004445 1.0029701 1.0066483 1.0083919 1.0067487 1.0025601 0.9967495 
        9        10        11        12 
0.9916610 0.9914426 0.9952958 0.9989352 

$estimate
          Jan      Feb      Mar      Apr      May      Jun      Jul      Aug
1959 315.4200 317.1341 317.8304 318.6428 319.3654 319.8462 319.7516 319.2141
1960 317.4611 317.5099 317.6698 318.2038 318.8141 319.1390 318.9724 318.3114
1961 316.5351 316.7043 317.0333 317.6393 318.3391 318.6164 318.4580 317.9287
1962 317.2435 317.4895 317.9422 318.6484 319.2622 319.5046 319.3430 318.7119
1963 318.1276 318.3201 318.6455 319.3871 320.1057 320.3097 319.9389 319.1760
1964 318.7100 319.0377 319.4542 320.0862 320.6468 320.7678 320.3706 319.6423
1965 319.1956 319.4681 319.7803 320.4569 320.8968 320.8910 320.5526 319.7361
1966 320.0206 320.4193 320.9070 321.7537 322.3885 322.5128 322.1151 321.2978
1967 321.6357 321.9382 322.2745 323.0062 323.5622 323.4605 322.8110 321.8661
1968 322.3087 322.5903 322.9511 323.6599 324.1669 324.1553 323.6488 322.7348
1969 323.4052 323.7572 324.2815 325.1104 325.7370 325.6968 325.2414 324.3170
1970 325.0554 325.4242 325.9025 326.7274 327.1570 326.9815 326.2894 325.2794
1971 326.0646 326.3521 326.6604 327.2085 327.6512 327.4835 326.8220 325.7746
1972 326.6297 326.9980 327.2877 328.1299 328.6345 328.3616 327.6362 326.5715
1973 328.2197 328.7379 329.2870 330.1797 330.8452 330.8107 330.2441 329.3401
1974 330.3364 330.6656 331.0480 331.7936 332.1972 331.8226 330.9896 329.8035
1975 330.5844 330.9465 331.3244 332.1018 332.5731 332.3490 331.5068 330.2998
1976 331.6178 332.0463 332.5435 333.3833 333.8110 333.4911 332.6494 331.3717
1977 332.6240 333.0346 333.5893 334.5451 335.1413 334.9674 334.2315 333.0259
1978 334.8976 335.3312 335.8885 336.7842 337.2149 336.9564 336.1346 334.9158
1979 336.3479 336.7450 337.2621 338.0791 338.5075 338.2259 337.3325 336.0999
1980 337.7711 338.2180 338.8966 339.7980 340.3107 340.0654 339.1806 337.8793
1981 339.5544 340.0921 340.6715 341.5745 342.0171 341.6181 340.5571 339.0796
1982 340.6730 341.1953 341.8051 342.6742 343.1169 342.6836 341.6890 340.2316
1983 341.6148 342.1148 342.5944 343.5657 344.1457 343.8998 343.0557 341.8666
1984 343.8930 344.4172 344.9540 345.9510 346.4392 346.0553 345.0631 343.6263
1985 345.3355 345.8508 346.5266 347.4560 347.9219 347.5024 346.4097 344.9388
1986 346.6946 347.1154 347.5932 348.5196 348.9976 348.5854 347.5133 346.0267
1987 348.1087 348.5708 349.0935 350.0293 350.5494 350.1788 349.1058 347.7542
1988 350.2918 351.0545 351.7388 352.7611 353.2893 352.9465 351.9589 350.5558
1989 352.9455 353.4603 353.9475 354.8799 355.2399 354.7162 353.6081 352.0420
1990 353.9130 354.5002 355.0734 355.8839 356.2898 355.7194 354.5303 352.9680
1991 355.0793 355.6461 356.3614 357.4382 358.0207 357.5550 356.3025 354.6294
1992 356.3355 356.8365 357.4275 358.3748 358.7891 358.3247 357.0347 355.3611
1993 356.9327 357.3752 357.9485 358.8251 359.2436 358.7187 357.4194 355.7365
1994 357.9610 358.6134 359.3332 360.3777 360.8426 360.3326 359.1737 357.6065
1995 360.2382 360.9406 361.6027 362.7048 363.1896 362.7310 361.6130 359.9927
1996 362.4209 363.1566 363.8778 364.7818 365.1639 364.6270 363.4479 361.8377
1997 363.8622 364.4108 364.9235 365.8926 366.2771 365.5818 364.2991 362.6499
          Sep      Oct      Nov      Dec
1959 318.5194 317.7821 317.5365 317.4073
1960 317.4375 316.6825 316.4536 316.4292
1961 317.2089 316.8152 316.8602 316.9868
1962 318.0962 317.5844 317.6791 317.8412
1963 318.3964 317.9340 318.0791 318.3319
1964 318.8292 318.4845 318.7092 318.9561
1965 319.0965 318.8018 319.2736 319.6106
1966 320.5355 320.1685 320.6425 321.1092
1967 321.0372 320.8144 321.3736 321.8991
1968 321.9328 321.7280 322.2786 322.8576
1969 323.6353 323.4583 324.0599 324.5975
1970 324.4771 324.3636 325.0265 325.5796
1971 324.8569 324.7381 325.4874 326.1373
1972 325.7844 325.8545 326.8041 327.5814
1973 328.6239 328.6293 329.4586 329.9903
1974 328.8246 328.7079 329.4859 330.1192
1975 329.4154 329.3798 330.2629 331.0174
1976 330.4036 330.2959 331.1804 331.9575
1977 332.2279 332.2734 333.2818 334.1714
1978 333.9495 333.9221 334.9097 335.6889
1979 335.0722 335.0591 336.0903 336.9992
1980 336.8952 336.9818 338.0397 338.8945
1981 337.9423 337.9336 339.0203 339.9351
1982 339.0955 339.0512 340.0967 340.9705
1983 340.8134 340.9177 342.0468 343.1232
1984 342.4241 342.4580 343.6401 344.6322
1985 343.8474 343.8757 345.0257 346.0082
1986 345.0454 345.1052 346.3069 347.3168
1987 346.7570 346.9511 348.2729 349.3614
1988 349.4910 349.6957 350.9725 352.0456
1989 350.8056 350.8889 352.1030 353.1203
1990 351.7266 351.8342 353.1577 354.3070
1991 353.3026 353.3150 354.5357 355.5656
1992 354.0136 354.0796 355.2093 356.1610
1993 354.4215 354.5333 355.8196 356.9642
1994 356.4210 356.6278 358.0481 359.2984
1995 358.8138 358.9319 360.3261 361.4776
1996 360.5288 360.6484 361.9062 363.0416
1997 361.2467 361.4040 362.8189 364.1579

$accurate
          SST           SSE           MSE          RMSE          MAPE 
 1.046023e+05  4.879924e+02  1.047194e+00  1.023325e+00  2.425970e-01 
          MPE           MAE            ME     R.squared R.adj.squared 
-5.136392e-02  8.040919e-01 -1.645924e-01  9.953348e-01  9.953248e-01 
 RW.R.squared           AIC           SBC           APC 
 1.720021e+17  2.357715e+01  3.187408e+01  1.051669e+00 

attr(,"class")
[1] "Winters"
$season
        1         2         3         4         5         6         7         8 
0.8624731 0.8383916 0.9638530 0.9528529 0.9697991 1.1119094 1.2534252 1.2525333 
        9        10        11        12 
1.0789089 0.9510690 0.8306617 0.9341228 

$estimate
          Jan      Feb      Mar      Apr      May      Jun      Jul      Aug
1949 112.0000 126.4730 151.9727 154.8134 157.9726 180.2408 200.3914 197.1811
1950 130.3321 128.9781 148.5032 146.1715 144.5754 163.9644 183.2402 181.8705
1951 132.6979 134.9081 160.5496 160.5919 165.7932 189.5988 212.9014 212.2351
1952 160.7191 163.8951 189.9750 187.0009 188.9436 218.9092 245.5410 247.6522
1953 187.7661 188.5398 220.9989 222.4343 227.3169 259.5075 289.3160 289.4522
1954 203.8320 198.0736 227.3669 223.1736 226.5828 260.8146 296.5334 298.4823
1955 225.3386 225.1549 259.5354 257.7705 262.7868 305.7679 351.7091 356.0413
1956 273.7592 273.3124 314.4798 310.0844 315.0823 366.2680 416.6936 420.6241
1957 310.7125 306.2667 351.2501 344.4492 348.9730 405.9514 461.8839 468.9945
1958 344.3131 335.1262 377.1323 362.2934 362.6382 418.5751 475.7404 485.7561
1959 350.0324 343.2932 393.0692 384.3232 392.7211 454.5588 521.0402 534.8767
1960 408.2790 400.7817 449.1584 442.3482 450.9849 521.7148 597.7746 606.9385
          Sep      Oct      Nov      Dec
1949 169.1920 147.3874 127.0387 141.0799
1950 159.0389 139.3861 120.7520 137.8096
1951 186.5427 165.0921 145.9706 166.8932
1952 216.9303 192.5372 170.7615 195.4461
1953 252.2943 221.3393 192.1125 215.4586
1954 262.6709 231.8484 204.0504 232.2115
1955 316.2334 280.4397 246.3836 282.3056
1956 371.0449 325.4580 284.7249 322.5099
1957 415.0936 364.5726 318.9842 359.5410
1958 424.9093 372.1615 323.8325 362.3508
1959 473.2509 417.6898 368.1777 418.8754
1960 533.4495 471.5294 411.7050 463.5513

$accurate
          SST           SSE           MSE          RMSE          MAPE 
 2.058044e+06  3.423723e+04  2.411073e+02  1.552763e+01  5.366605e+00 
          MPE           MAE            ME     R.squared R.adj.squared 
-2.786876e+00  1.207844e+01 -4.213618e+00  9.833642e-01  9.832470e-01 
 RW.R.squared           AIC           SBC           APC 
 3.464254e+17  7.918608e+02  7.978005e+02  2.444560e+02 

attr(,"class")
[1] "Winters"

aTSA documentation built on May 1, 2019, 8:47 p.m.