Smoothing time series
Time series decomposition allows us to extract distinct components from time series data. The smoothing technique enables us to forecast the future values of time series data. In this recipe, we introduce how to use the
HoltWinters function to smooth time series data.
Ensure you have completed the previous recipe by generating a time series object and storing it in two variables:
How to do it…
Please perform the following steps to smooth time series data:
- First, use
HoltWintersto perform Winters exponential smoothing:
> m.pre <- HoltWinters(m) > m.pre Holt-Winters exponential smoothing with trend and additive seasonal component. Call: HoltWinters(x = m) Smoothing parameters: alpha: 0.8223689 beta : ...