Exponential Smoothing Model - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


TimeSeriesAnalysis

  

ExponentialSmoothingModel

  

exponential smoothing model

 

Calling Sequence

Parameters

Description

Model Variants

Typical Usage

Model Equations

Options

Working with Model Parameters

Examples

References

Compatibility

Calling Sequence

ExponentialSmoothingModel(ts, E, T, S, opts)

Parameters

ts

-

(optional) Time series consisting of a single data set

E

-

(optional) types of error allowed (name, string, or set of these)

T

-

(optional) types of trend allowed (name, string, or set of these)

S

-

(optional) types of seasonal influence allowed (name, string, or set of these)

opts

-

(optional) equations of the form optionname = value to set other parameters

Description

• 

The ExponentialSmoothingModel command creates an exponential smoothing model or ETS model for a time series. These models are a generalization of the idea to use exponential smoothing of the previous data as a forecast. The model can get its parameters optimized automatically to fit a given time series, or the parameters can be set by hand.

Model Variants

• 

There are 30 variants of this model. They are distinguished by:

– 

whether errors are additive or multiplicative;

– 

whether there is a trend, and if there is one, if it is additive or multiplicative and whether it is damped or not;

– 

whether there is seasonal influence, and if there is, whether it is additive or multiplicative.

• 

By default, Maple creates a model that potentially represents any of the 30 variants. Maple can automatically select one that is appropriate for a time series, or you can restrict the selection manually.

• 

Restricting the selection manually can be done with the E, T, and S parameters, or by using the named options errors, trend, and seasonal. If using E, T, and S, one needs to supply all three parameters; using the named options, one can use any subset. The values are given by the following table.

Value (long)

Value(short)

errors / E

trend / T

seasonal / S

none

N

-

+

+

additive

A

+

+

+

additivedamped

Ad

-

+

-

multiplicative

M

+

+

+

multiplicativedamped

Md

-

+

-

• 

For example, the third row of this table says that only the trend or T parameter can be additive damped, not the errors or seasonal parameter. These values are supplied either in short or long form and can be either a string or a name. If a single value is desired, then one can use the corresponding string or name by itself; otherwise a set must be given. For example, you could specify errors = "A" to consider only models with additive error, or seasonal = {"additive", "M"} to consider models with additive or multiplicative seasonality (but not models without seasonal influence).

• 

The option damping = false will exclude the models with damped trend from being considered.

• 

Some of these models lead to numerical difficulties. These are not considered by default. For more details, see the Specialize help page.

Typical Usage

• 

If you supply a time series to the ExponentialSmoothingModel command, Maple will compute the most suitable model for that time series. If you do not supply a time series to ExponentialSmoothingModel, you can perform the steps involved by hand, otherwise they happen behind the scenes:

– 

First, use the Specialize command. This command, and all of the following, do require a time series argument. It returns a list of models of all variants that are suitable for the time series and compatible with the given options.

– 

Then, use the Initialize command. This command finds and records initial values for the optimization procedure run next.

– 

The Optimize command subsequently optimizes the parameters and initial values -- starting from the values generated by the Initialize command.

– 

Finally, to select which model is the most suitable, compare the LogLikelihood and the NumberOfParameters of each candidate. Standard ways to do this are to use one of the AICc, AIC, and BIC commands to compute the corresponding information criteria, and select the model where the value is lowest. If you supply a time series to the original ExponentialSmoothingModel command, the AICc command is used.

• 

Once the model has been generated, either fully automatically or by hand, you can use the OneStepForecasts command to see if the fit is good enough for your purposes, and then Forecast to get a forecast of future values. Both of these can include confidence intervals (obtained through simulation).

Model Equations

• 

We present the equations for all variants of the model in innovation state space form.

• 

The equations for the models can be given in terms of these variables:

– 

The actual output at time t is a variable yt.

– 

The level at time t is denoted by t.

– 

Models with trend have a trend variable, bt.

– 

Models with seasonality have a seasonal variable, st.

– 

There are errors εt.

• 

The variables 0, b0, and s1m through s0, if present, need to be initialized. The number m is the period of the season. In addition there are parameters: α is always present, β is present in models with trend, φ is present in models with a damped trend, and γ is present in models with seasonality.

• 

We define the equations defining the variables at time t. We start by introducing three auxiliary variables: y1t,  y2t, and y3t.

– 

The variable y1t accounts for the trend. It is defined by:

y1t={0trend=nonebt1trend=additiveφbt1trend=additivedampedbt1trend=multiplicativebt1φtrend=multiplicativedamped

– 

The variable y2t accounts for the previous level and, if applicable, the trend. It is defined by:

y2t={t1trend=nonet1+y1ttrend=additivet1+y1ttrend=additivedampedt1y1ttrend=multiplicativet1y1ttrend=multiplicativedamped

– 

The variable y3t is like y2t, except it also accounts for seasonal effects. (This is essentially the forecast for the output at t.) It is defined by:

y3t={y2tseasonal=noney2t+stmseasonal=additivey2tstmseasonal=multiplicative

– 

Now yt can be defined as follows:

yt={y3t+ϵterrors=additivey3t1+ϵterrors=multiplicative

– 

The level t can be computed in the following manner:

t={{y2t+αϵtstmseasonal=multiplicativeαϵt+y2totherwiseerrors=additive{y2t+αy2t+stmϵtseasonal=additivey2tαϵt+1otherwiseerrors=multiplicative

– 

For models with trend, we define bt as follows.

bt={y1t+βϵt{stmseasonal=multiplicative1otherwise{t1trendmultiplicative,multiplicativedamped1otherwiseerrors=additive{y1t+βy1t+t1+{stmseasonal=additive0otherwiseϵttrendadditive,additivedamped{y1t+βy1t+stmt1ϵtseasonal=additivey1tβϵt+1otherwisetrendmultiplicative,multiplicativedampederrors=multiplicative

– 

For models with seasonal influence, we define st as follows.

st={{γϵt+stmseasonal=additivestm+γϵty2tseasonal=multiplicativeerrors=additive{stm+γy2t+stmϵtseasonal=additivestmγϵt+1seasonal=multiplicativeerrors=multiplicative

Options

  

The following options can be specified:

• 

errors, trend, seasonal : string or name or set of strings or names

  

Discussed in the section on model variants.

• 

alpha, beta, gamma, phi : numeric

  

Fixes the value of the given parameter, discussed in the section on model equations. This means that these parameters won't be subject to optimization when Optimize is called.

• 

period : positive integer

  

Sets the period m of the season. If it is not specified explicitly, the period is taken from the time series supplied during the Optimize call. A value of 1 disables the use of model variants with seasonal influence. Exponential smoothing models are most effective when the period is at most 12; an error will be given for periods greater than 24.

• 

l0, b0 : numeric

  

Fixes the value of the given initial value, 0 or b0, respectively; they are the initial values for t and bt, discussed in the section on model equations. If not specified, the initial values are subject to optimization when Optimize is called.

• 

s : list or Vector with numeric entries

  

Initial values for the seasonal parameter s. There are m values, one for each period. They correspond to the values s1m, ..., s0, and they need to occur in that order in the list or Vector. If not specified, these values are subject to optimization when Optimize is called.

• 

sigma : numeric

  

The standard deviation of the normal random variable that supplies the errors, εt in the section on model equations. If not specified explicitly, its value is taken from the errors in the time series supplied to Optimize.

• 

damping : true or false

  

If damping = false is included as an option, then models with damped trend will not be considered. The default is damping = true.

• 

constraints : equal to usual, admissible, or both

  

There are traditional constraints on the parameters α, β, γ, and φ that allow for the model to be interpreted in the framework of exponential smoothing. These are called the "usual" constraints. There are also constraints (typically, but not always, less strict) that need to be satisfied for the model to be numerically stable, or "admissible". The constraints option selects which constraints are used: constraints = usual uses only the usual constraints, constraints = admissible uses only the constraints for an admissible model, and constraints = both (the default) uses both sets of constraints.

• 

criterion : procedure

  

By default, as explained in the section on typical usage, Maple uses Akaike's information criterion with the sample size correction, AICc, to select the best model. If you supply the criterion option, you can choose a different criterion. Typical choices would be AIC or BIC, but you can also supply a different procedure. This procedure will be passed three arguments: the model, the time series, and the argument loglikelihood = ll, where ll is the precomputed log likelihood. The procedure should return a number. Maple selects the model where the returned value is the lowest.

Working with Model Parameters

• 

The exponential smoothing model constructed by this command has parameters that can be examined and set using the GetParameter, GetParameters, and SetParameter commands. These correspond loosely to the named options above, but they are generally less flexible. The parameters are detailed below, with a description of what are legal values for the parameter. When using SetParameter, you need to make sure that the new value conforms with these restrictions.

Parameters

Legal values

errors, trend, seasonal

set of one- or two-letter strings (a suitable subset of A,Ad,M,Md,N)

alpha, beta, gamma, phi, l0, b0, sigma

algebraic constant

period

positive integer

s

Vector with rtable options given by datatype = float[8] and storage = rectangular, and no indexing functions

constraints

string, in particular one of "usual", "admissible", or "both"

• 

There is no damping parameter - that information is encoded in the errors, trend, and seasonal parameters. There is also no criterion parameter: that information is only used when a time series is included in the ExponentialSmoothingModel calling sequence.

• 

If there is no seasonality, the value of period is 1.

Examples

withTimeSeriesAnalysis:

Consider the following time series. It represents international tourist visitor nights in Australia.

tsTimeSeries41.7,24.0,32.3,37.3,46.2,29.3,36.5,43.0,48.9,31.2,37.7,40.4,51.2,31.9,41.0,43.8,55.6,33.9,42.1,45.6,59.8,35.2,44.3,47.9,startdate=2005,frequency=quarterly,header=Visitor nights

tsTime seriesVisitor nights24 rows of data:2005-Jan-01 - 2010-Oct-01

(1)

We fit an exponential smoothing model to it.

esmExponentialSmoothingModelts

esm< an ETS(M,A,M) model >

(2)

To evaluate the fit of this model, view the one step forecasts.

onestepfcsOneStepForecastsesm&comma;ts

onestepfcsTime seriesVisitor nights (1 step forecasts)24 rows of data:2005-Jan-01 - 2010-Oct-01

(3)

TimeSeriesPlotonestepfcs&comma;color=Spring Blue&comma;thickness=2&comma;ts&comma;color=Spring Rose&comma;thickness=4



Let's add 80% and 95% confidence intervals.

onestepconfOneStepForecastsesm&comma;ts&comma;output=percentiles2.5&comma;10&comma;90&comma;97.5

onestepconfTime seriesVisitor nights (1 step forecast - 2 percentile), ..., Visitor nights (1 step forecast - 98 percentile)24 rows of data:2005-Jan-01 - 2010-Oct-01

(4)

TimeSeriesPlotonestepfcs&comma;color=Spring Blue&comma;thickness=2&comma;onestepconf&comma;color=Spring YellowGreen..Spring BlueGreen&comma;ts&comma;color=Spring Rose&comma;thickness=4



The fit looks pretty good. Now let us add the forecasts.

fcsForecastesm&comma;ts&comma;8

fcsTime seriesVisitor nights (forecast)8 rows of data:2010-Dec-31 - 2012-Sep-30

(5)

confForecastesm&comma;ts&comma;8&comma;output=percentiles2.5&comma;10&comma;90&comma;97.5

confTime seriesVisitor nights (forecast - 2 percentile), ..., Visitor nights (forecast - 98 percentile)8 rows of data:2010-Dec-31 - 2012-Sep-30

(6)

TimeSeriesPlotonestepfcs&comma;color=Spring Blue&comma;thickness=2&comma;onestepconf&comma;color=Spring YellowGreen..Spring BlueGreen&comma;fcs&comma;color=Spring Blue&comma;thickness=2&comma;legend=&comma;conf&comma;color=Spring YellowGreen..Spring BlueGreen&comma;legend=&comma;ts&comma;color=Spring Rose&comma;thickness=4



Doing this by hand, we could go about this as follows. We see that the seasonal influence is very significant; a model that doesn't take that into account is not likely to do well. We will also relax the constraints to allow all admissible parameter values.

esm2ExponentialSmoothingModelseasonal=A&comma;M&comma;constraints=admissible

esm2< an ETS(*,*,*) model >

(7)

Transform to a collection of specialized models.

modelsSpecializeesm2&comma;ts

models< an ETS(A,A,A) model >&comma;< an ETS(A,Ad,A) model >&comma;< an ETS(A,N,A) model >&comma;< an ETS(M,A,A) model >&comma;< an ETS(M,A,M) model >&comma;< an ETS(M,Ad,A) model >&comma;< an ETS(M,Ad,M) model >&comma;< an ETS(M,M,M) model >&comma;< an ETS(M,Md,M) model >&comma;< an ETS(M,N,A) model >&comma;< an ETS(M,N,M) model >

(8)

Find initial points for optimization for all of these.

initsmapInitialize&comma;models&comma;ts&colon;

Optimize all of them.

foritonumelemsmodelsdoOptimizemodelsi&comma;ts&comma;initsienddo&colon;

Evaluate the Bayesian information criterion for each model.

mapmodelprintmodel&comma;BICmodel&comma;ts&comma;models&colon;

< an ETS(A,A,A) model >,126.7819508

< an ETS(A,Ad,A) model >,126.9258852

< an ETS(A,N,A) model >,129.9242821

< an ETS(M,A,A) model >,141.6667862

< an ETS(M,A,M) model >,109.4702551

< an ETS(M,Ad,A) model >,135.7502647

< an ETS(M,Ad,M) model >,109.9821406

< an ETS(M,M,M) model >,111.2692148

< an ETS(M,Md,M) model >,109.4060877

< an ETS(M,N,A) model >,140.6230023

< an ETS(M,N,M) model >,112.5756460

(9)

Compare all models' fits.

colorsColorTools:-GradientNiagara Navy..Niagara Purple&comma;number=numelemsmodels

colorsRGB : 0 0.0549 0.471&comma;RGB : 0.0392 0.0503 0.469&comma;RGB : 0.0784 0.0458 0.467&comma;RGB : 0.118 0.0412 0.465&comma;RGB : 0.157 0.0366 0.463&comma;RGB : 0.196 0.032 0.461&comma;RGB : 0.235 0.0275 0.459&comma;RGB : 0.275 0.0229 0.457&comma;RGB : 0.314 0.0183 0.455&comma;RGB : 0.353 0.0137 0.453&comma;RGB : 0.392 0.00915 0.451&comma;RGB : 0.431 0.00458 0.449&comma;RGB : 0.471 0 0.447

(10)

TimeSeriesPlotseqOneStepForecastsmodelsi&comma;ts&comma;color=ToPlotColorcolorsi&comma;legend=print_preprocessmodelsi&comma;i=1..numelemsmodels&comma;ts&comma;color=Niagara Green&comma;thickness=3



In the following example, let's assume we know beforehand that we want a model with additive errors, a trend that is either additive or additive damped, and additive or multiplicative seasonality. Additionally, we know that α is equal to 110 and φ, if present in the model, is equal to 0.95.

esm3ExponentialSmoothingModelts&comma;A&comma;A&comma;Ad&comma;A&comma;M&comma;α=110&comma;φ=0.95

esm3< an ETS(A,A,A) model >

(11)

The optimized model is in this case not a damped model. So φ is not part of this model, and therefore its value is set to the default - 1. The setting of α we required is respected.

GetParameteresm3&comma;α&comma;φ

110&comma;1.

(12)

A plot of data and forecasts:

TimeSeriesPlotts&comma;color=Niagara Green&comma;OneStepForecastsesm3&comma;ts&comma;Forecastesm3&comma;ts&comma;8&comma;output=percentiles2.5&comma;10&comma;50&comma;90&comma;97.5



References

  

Hyndman, R.J. and Athanasopoulos, G. (2013) Forecasting: principles and practice. http://otexts.org/fpp/. Accessed on 2013-10-09.

  

Hyndman, R.J., Koehler, A.B., Ord, J.K., and Snyder, R.D. (2008) Forecasting with Exponential Smoothing: The State Space Approach. Springer Series in Statistics. Springer-Verlag Berlin Heidelberg.

Compatibility

• 

The TimeSeriesAnalysis[ExponentialSmoothingModel] command was introduced in Maple 18.

• 

For more information on Maple 18 changes, see Updates in Maple 18.

See Also

Initialize

LogLikelihood

Optimize

Specialize

TimeSeriesAnalysis