ESMOOTH Instruction |
ESMOOTH( options ) series start end
ESMOOTH performs one of nine possible exponential smoothing techniques on a series. It can forecast, smooth or seasonally adjust a series.
Wizard
The Time Series—Exponential Smoothing Wizard provides dialog-driven access to most of the features of ESMOOTH.
Parameters
series |
Series to smooth, seasonally adjust or forecast. |
start, end |
Range to smooth. If you have not set a SMPL, this defaults to the defined range of series. |
Options
TREND=[NONE]/LINEAR/EXPONENTIAL/SELECT
SEASONAL=[NONE]/ADDITIVE/MULTIPLICATIVE/SELECT
These jointly determine the type of model. You can choose any combination of the two. The linear trend model is the Holt–Winters two parameter model. If you choose SELECT, ESMOOTH tests all three choices for that option, and chooses the best-fitting model. Used together, TREND=SELECT and SEASONAL=SELECT gives you the best-fitting combination.
SMOOTHED=smoothed series (set over start to end) [not used]
RESIDS=series of residuals (in-sample forecast errors) [not used]
FACTORS=seasonal factors series [not used]
FITTED=in-sample fitted values [not used]
These options allow you to save some of the series produced by the smoothing process. Each is defined over the period start to end. For seasonal data, the smoothed output is the seasonally adjusted series.
FORECASTS=series for out-of-sample forecasts [not used]
STEPS=number of out-of-sample forecast steps to compute [not used]
If you want to generate forecasts, use FORECASTS to provide a series name to hold the forecasts, and STEPS to set the number of forecasts steps (periods). ESMOOTH forecasts the steps periods after end.
ESTIMATE/[NOESTIMATE]
ALPHA=constant level smoothing parameter [.3]
GAMMA=trend smoothing parameter [.3]
DELTA=seasonal smoothing parameter [.3]
CONSTRAIN/[NOCONSTRAIN]
INITIAL=[FULL]/START
If you use the ESTIMATE option, ESMOOTH finds the values for \(\alpha\), \(\gamma\) and \(\delta\) (see "Technical Information") which produce the best fit with the data by minimizing the sum of squared in-sample forecast errors. By default (with NOESTIMATE), the three other options provide the values of \(\alpha\), \(\gamma\) and \(\delta\). In all cases, values close to zero provide the most smoothing; values close to one the least. Note: if you use SELECT for TREND or SEASONAL, ESMOOTH always estimates the parameters.
When estimating parameters, use CONSTRAIN to constrain the estimated parameter values to the range [0,1]. With INITIAL=START, ESMOOTH will use only a minimal number of early observations for initializing recursions for TREND and SEASONAL components. Otherwise, it will use estimates from the full sample.
SPAN=seasonal span [CALENDAR seasonal]
You can use SPAN to change the number of periods per “year” used in the seasonal models.
[PRINT]/NOPRINT
This matters only if you use ESTIMATE or one of the SELECT choices. PRINT outputs the squared-error statistics and the final estimated coefficients.
Description
You choose which of the nine methods you want by choosing a trend model: no trend, linear trend (Holt–Winters) or exponential trend; and a seasonality model: no seasonal, additive seasonal, multiplicative seasonal. You can, of course, allow TREND=SELECT and/or SEASONAL=SELECT to help you make the decision. See “Technical Information” for a description of the models and formulas.
Missing Values
ESMOOTH simply smooths over missing values, assuming (in effect) that the missing datum is the forecast value for that period. This permits you to use ESMOOTH for patching gaps in a time series, provided:
•the series is reasonably smooth, so an exponential smoothing representation is adequate.
•the gaps are not too near the start of the data, since exponential smoothing relies solely on the past for the generation of the smoothed data.
Variables Defined
%NOBS |
entry at which maximum is reached (INTEGER) |
%RSS |
maximum value (REAL) |
%ESALPHA |
value of alpha, the level smoothing parameter (REAL) |
%ESGAMMA |
value of gamma, the trend smoothing parameter (REAL) |
%ESDELTA |
value of delta, the seasonal smoothing parameter (REAL) |
Examples
This estimates the smoothing coefficient for an ES model with a linear trend (constained to [0,1]) and forecasts 18 steps out of sample into the series FSMOOTH.
cal(m) 1973
open data exch.dat
data(format=prn,org=columns) 1973:1 1996:7 yen dm
*
set logyen = log(yen)
*
*
set forezone * 2010:12 = t>=1995:1
esmooth(trend=linear,estimate,constrain,initial=start,forecast=fsmooth,$
steps=18) logyen * 1994:12
*
graph(footer="Figure 12.18 Log Yen/Dollar Rate: History and Forecast",$
subhead="Holt-Winters Smoothing",shading=forezone) 2
# logyen 1990:1 1994:12
# fsmooth 1995:1 1996:7
This smooths a short series with several values for the level smoothing parameter, saving the "fitted" values, which are the one step in-sample forecasts. Those are compared with the actual data, using @UFOREERRORS.
data(unit=input) 1 11 shipments
200 135 195 197.5 310 175 155 130 220 277.5 235
*
esmooth(alpha=.1,fitted=sm1) shipments
@uforeerrors(title="SES with Alpha=.1") shipments sm1 2 11
esmooth(alpha=.5,fitted=sm5) shipments
@uforeerrors(title="SES with Alpha=.5") shipments sm5 2 11
esmooth(alpha=.9,fitted=sm9) shipments
@uforeerrors(title="SES with Alpha=.9") shipments sm9 2 11
Sample Output
ESMOOTH only creates output if you estimate the coefficients or have it auto-select a model. This is the output from the first example above.
Exponential Smoothing for Series LOGYEN
Model with TREND=Linear , SEASONAL=None
Alpha (level) 0.999995
Gamma (trend) 0.297342
This is the output from an example with TREND=SELECT and SEASONAL=SELECT. It shows a table with all the model combinations, then shows the point estimates for the selected one (the one with the minimum SBC).
Exponential Smoothing for Series JPNIPTOTRS
Model Selection
TREND SEASONAL SumSquares SBC
None None 3668.45317 1062.4
None Additive 3827.11790 1092.6
None Multiplicative 4182.33142 1142.7
Linear None 551.21387 -0.3
Linear Additive 541.19230 -4.3
Linear Multiplicative 577.28163 32.1
Exponential None 630.73239 75.7
Exponential Additive 642.43559 92.4
Exponential Multiplicative 650.68991 99.6
Model with TREND=Linear , SEASONAL=Additive
Alpha (level) 0.631238
Gamma (trend) 0.285467
Delta (seasonal) -0.045443
Notes on SELECT
You should not automatically use SELECT for the options. ESMOOTH sees a series as just a set of numbers. It has no knowledge of how the series is expected to behave—you do! If it sees a general upward movement over the data set, it may very well select a trending model over a non-trending one. It can do this even for a series (such as U.S. interest rates during 1960-1980) where you probably would not choose to include a trend yourself. With enough data, ESMOOTH will probably pick the model which is truly the best of those available, but with small data sets, your judgment becomes very important.
The table below lists the error-correction forms of the models used for the different combinations of SEASONAL (top) and TREND (left). We are using Gardner’s (1985) notation:
\(S_t\) |
smoothed level of the series |
\(T_t\) |
trend rate |
\(I_t\) |
seasonal index (factor) |
\(e_t\) |
period t forecast error |
\(p\) |
seasonal span |
|
No Seasonal |
Additive Seasonal |
Multiplicative Seasonal |
No Trend |
\({S_t} = {S_{t - 1}} + \alpha \,{e_t}\) |
\({S_t} = {S_{t - 1}} + \alpha \,{e_t}\)
\({I_t} = {I_{t - p}} + \delta {\kern 1pt} \left( {1 - \alpha } \right){\kern 1pt} {\kern 1pt} {e_t}\) |
\({S_t} = {S_{t - 1}} + \alpha \,{e_t}/{I_{t - p}}\)
\({I_t} = {I_{t - p}} + \delta {\kern 1pt} \left( {1 - \alpha } \right){\kern 1pt} {\kern 1pt} {e_t}/{S_t}\) |
Linear Trend |
\({S_t} = {S_{t - 1}} + {T_{t - 1}} + \alpha \,{e_t}\)
\({T_t} = {T_{t - 1}} + \alpha {\kern 1pt} \gamma {\kern 1pt} {e_t}\) |
\({S_t} = {S_{t - 1}} + {T_{t - 1}} + \alpha \,{e_t}\)
\({T_t} = {T_{t - 1}} + \alpha {\kern 1pt} \gamma {\kern 1pt} {e_t}\)
\({I_t} = {I_{t - p}} + \delta {\kern 1pt} \left( {1 - \alpha } \right){\kern 1pt} {\kern 1pt} {e_t}\) |
\({S_t} = {S_{t - 1}} + {T_{t - 1}} + \alpha {\kern 1pt} {e_t}/{I_{t - p}}\)
\({T_t} = {T_{t - 1}} + \alpha {\kern 1pt} \gamma {\kern 1pt} {e_t}/{I_{t - p}}\)
\({I_t} = {I_{t - p}} + \delta {\kern 1pt} \left( {1 - \alpha } \right){\kern 1pt} {\kern 1pt} {e_t}/{S_t}\) |
Exponential Trend |
\({S_t} = {S_{t - 1}}{T_{t - 1}} + \alpha \,{e_t}\)
\({T_t} = {T_{t - 1}} + \alpha {\kern 1pt} \gamma {\kern 1pt} {e_t}/{S_{t - 1}}\) |
\({S_t} = {S_{t - 1}}{T_{t - 1}} + \alpha \,{e_t}\)
\({T_t} = {T_{t - 1}} + \alpha {\kern 1pt} \gamma {\kern 1pt} {e_t}/{S_{t - 1}}\)
\({I_t} = {I_{t - p}} + \delta {\kern 1pt} \left( {1 - \alpha } \right){\kern 1pt} {\kern 1pt} {e_t}\) |
\({S_t} = {S_{t - 1}}{T_{t - 1}} + \alpha \,{e_t}/{I_{t - p}}\)
\({T_t} = {T_{t - 1}} + \alpha {\kern 1pt} \gamma {\kern 1pt} {e_t}/\left( {{I_{t - p}}{S_{t - 1}}} \right)\)
\({I_t} = {I_{t - p}} + \delta {\kern 1pt} \left( {1 - \alpha } \right){\kern 1pt} {\kern 1pt} {e_t}/{S_t}\) |
ESMOOTH uses the simplex method to estimate parameters, minimizing the sum of \(e_t^2\). It obtains initial values for \(I_t\) by a regression of the data on seasonal dummy variables and for \(T_t\) by a regression on a simple time trend.
Note, by the way, that while some programs limit the smoothing parameters to the range of [0,1], the smoothing model is stable for a wider range than that (for instance, [0,2] for \(\alpha\)), and the optimal values for many economic series are, in fact, greater than one. Thus ESMOOTH does not constrain the values to the [0,1] range by default. If you do want to impose the [0,1] constraint, use the CONSTRAIN option.
Copyright © 2025 Thomas A. Doan