exponential smoothing model - Maple Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Statistics : Time Series Analysis Package : TimeSeriesAnalysis/ExponentialSmoothingModel

TimeSeriesAnalysis[ExponentialSmoothingModel] - exponential smoothing model

Calling Sequence

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




(optional) Time series consisting of a single data set



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



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



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



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



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)


errors / E

trend / T

seasonal / S



























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 epsilont.


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: alpha is always present, beta is present in models with trend, phi is present in models with a damped trend, and gamma 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:



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



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:



Now yt can be defined as follows:



The level t can be computed in the following manner:



For models with trend, we define bt as follows.



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




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, epsilont 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 alpha, beta, gamma, and phi 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.


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


positive integer


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


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.



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

ts:=TimeSeries41.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

ts:=Time seriesVisitor nights24 rows of data:2005-Jan-01 - 2010-Oct-01


We fit an exponential smoothing model to it.


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


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


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


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

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


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


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

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


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



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


TimeSeriesPlotonestepfcs&comma;color&equals;Spring Blue&comma;thickness&equals;2&comma;onestepconf&comma;color&equals;Spring YellowGreen..Spring BlueGreen&comma;fcs&comma;color&equals;Spring Blue&comma;thickness&equals;2&comma;legend&equals;&comma;conf&comma;color&equals;Spring YellowGreen..Spring BlueGreen&comma;legend&equals;&comma;ts&comma;color&equals;Spring Rose&comma;thickness&equals;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.


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


Transform to a collection of specialized models.


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 >


Find initial points for optimization for all of these.


Optimize all of them.

foritonumelemsmodelsdoOptimizemodelsi&comma;ts&comma;initsiend do&colon;

Evaluate the Bayesian information criterion for each model.


< an ETS(A,A,A) model >&comma;126.7819508

< an ETS(A,Ad,A) model >&comma;126.9258852

< an ETS(A,N,A) model >&comma;129.9242821

< an ETS(M,A,A) model >&comma;141.6667862

< an ETS(M,A,M) model >&comma;109.4702551

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

< an ETS(M,Ad,M) model >&comma;109.9821406

< an ETS(M,M,M) model >&comma;111.2692148

< an ETS(M,Md,M) model >&comma;109.4060877

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

< an ETS(M,N,M) model >&comma;112.5756460


Compare all models' fits.

colors:=ColorTools:-GradientNiagara Navy..Niagara Purple&comma;number&equals;numelemsmodels

colors:=RGB : 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


TimeSeriesPlotseqOneStepForecastsmodelsi&comma;ts&comma;color&equals;ToPlotColorcolorsi&comma;legend&equals;&apos;print_preprocess&apos;modelsi&comma;i&equals;1..numelemsmodels&comma;ts&comma;color&equals;Niagara Green&comma;thickness&equals;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 alpha is equal to 110 and phi, if present in the model, is equal to 0.95.


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


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




A plot of data and forecasts:

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

See Also

Initialize, Loglikelihood, Optimize, Specialize, TimeSeriesAnalysis



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.

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam