Examples / EXPSMOOTH2.RPF |
EXPSMOOTH2.RPF demonstrates the use of the ESMOOTH instruction for exponential smoothing. It “seasonally adjusts” Canadian retail sales over the existing data range.
The data file has both the raw retail sales (CANRETT) and officially seasonally adjusted data (CANRETTS).
open data oecdsample.rat
calendar(m) 1960
data(format=rats) 1960:1 2007:3 canrett canretts
This uses the SELECT choices for the TREND and SEASONAL to pick and estimate the "best" trending seasonal model for a series. The adjusted data are saved into CANRETSAX.
esmooth(trend=select,seasonal=select,smooth=canretsax) canrett
This graphs a comparison of this series with the “official” seasonally adjusted version over a six year period in the middle of the sample.
graph(footer="Seasonal Adjustment by Exponential Smoothing",key=upleft,$
klabels=||"Actual","SA-ESmooth","SA-Official"||) 3
# canrett 1994:1 1999:12
# canretsax 1994:1 1999:12
# canretts 1994:1 1999:12
Full Program
open data oecdsample.rat
calendar(m) 1960
data(format=rats) 1960:1 2007:3 canrett canretts
*
* Use ESMOOTH with selected trend and seasonal models, putting the
* "seasonally adjusted" series into CANRETSAX
*
esmooth(trend=select,seasonal=select,smooth=canretsax) canrett
*
graph(footer="Seasonal Adjustment by Exponential Smoothing",key=upleft,$
klabels=||"Actual","SA-ESmooth","SA-Official"||) 3
# canrett 1994:1 1999:12
# canretsax 1994:1 1999:12
# canretts 1994:1 1999:12
Output
Exponential Smoothing for Series CANRETT
Model Selection
TREND SEASONAL SumSquares SBC
None None 1919642978.894695 8531.21
None Additive 387239181.209608 7629.87
None Multiplicative 258039909.180180 7399.71
Linear None 1661329541.805498 8455.61
Linear Additive 139617130.682347 7057.79
Linear Multiplicative 76249709.192393 6714.82
Exponential None 1518459266.953026 8404.62
Exponential Additive 120020798.921642 6972.04
Exponential Multiplicative 76876443.721707 6719.46
Model with TREND=Linear , SEASONAL=Multiplicative
Alpha (level) 0.216416
Gamma (trend) 0.076146
Delta (seasonal) 0.352740
Graph
Copyright © 2025 Thomas A. Doan