TimeSeriesAnalysis
Optimize
fit parameters of an exponential smoothing model to a time series
Calling Sequence
Parameters
Description
Examples
References
Compatibility
Optimize(model, ts, init)
model
-
Exponential smoothing model
ts
Time series consisting of a single data set
init
(optional) table of initial parameter values
The Optimize command will fit unassigned parameter values of model to maximize the likelihood of obtaining the time series ts.
If a parameter was fixed when creating model, its value will not be subject to optimization. For example, if the calling sequence of ExponentialSmoothingModel includes the option alpha = 0.3, then calling Optimize on the resulting model keeps alpha fixed. (This is also true if Optimize is called automatically when ExponentialSmoothingModel gets a Time series as its first argument.)
Optimize is only guaranteed to find a local optimum; it calls Optimization[NLPSolve]. It uses the nonlinear simplex method (also known as Nelder-Mead).
The optimization process needs to be started with an initial point; this point is given by init. It uses the format returned by Initialize: it is a table with parameter names as indices and parameter values as values. If init is not given, Optimize calls Initialize and uses its output by default.
with⁡TimeSeriesAnalysis:
Consider the following time series. It represents international tourist visitor nights in Australia.
ts≔TimeSeries⁡41.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
esm≔ExponentialSmoothingModel⁡seasonal=A,M,constraints=admissible
esm≔< an ETS(*,*,*) model >
Transform to a collection of specialized models.
models≔Specialize⁡esm,ts
models≔< an ETS(A,A,A) model >,< an ETS(A,Ad,A) model >,< an ETS(A,N,A) model >,< an ETS(M,A,A) model >,< an ETS(M,A,M) model >,< an ETS(M,Ad,A) model >,< an ETS(M,Ad,M) model >,< an ETS(M,M,M) model >,< an ETS(M,Md,M) model >,< an ETS(M,N,A) model >,< an ETS(M,N,M) model >
Find initial points for optimization for all of these.
inits≔map⁡Initialize,models,ts:
Optimize all of them.
foritonumelems⁡modelsdoOptimize⁡modelsi,ts,initsienddo:
Alternatively, we can let Optimize call Initialize for us.
models2≔Specialize⁡esm,ts
models2≔< an ETS(A,A,A) model >,< an ETS(A,Ad,A) model >,< an ETS(A,N,A) model >,< an ETS(M,A,A) model >,< an ETS(M,A,M) model >,< an ETS(M,Ad,A) model >,< an ETS(M,Ad,M) model >,< an ETS(M,M,M) model >,< an ETS(M,Md,M) model >,< an ETS(M,N,A) model >,< an ETS(M,N,M) model >
map⁡Optimize,models2,ts
−43.87641045,−43.30741702,−47.25550594,−43.49539348,−42.02319299,−42.42526190,−40.68983138,−42.92489529,−40.42353080,−46.41831579,−46.75393519
Evaluate the Bayesian information criterion for each model.
map⁡model↦print⁡model,BIC⁡model,ts,models:
< 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
Compare all models' fits.
colors≔ColorTools:-Gradient⁡Niagara Navy..Niagara Purple,number=numelems⁡models
colors≔〈RGB : 0 0.0549 0.471〉,〈RGB : 0.0392 0.0503 0.469〉,〈RGB : 0.0784 0.0458 0.467〉,〈RGB : 0.118 0.0412 0.465〉,〈RGB : 0.157 0.0366 0.463〉,〈RGB : 0.196 0.032 0.461〉,〈RGB : 0.235 0.0275 0.459〉,〈RGB : 0.275 0.0229 0.457〉,〈RGB : 0.314 0.0183 0.455〉,〈RGB : 0.353 0.0137 0.453〉,〈RGB : 0.392 0.00915 0.451〉,〈RGB : 0.431 0.00458 0.449〉,〈RGB : 0.471 0 0.447〉
TimeSeriesPlot⁡seq⁡OneStepForecasts⁡modelsi,ts,color=ToPlotColor⁡colorsi,legend=modelsi,i=1..numelems⁡models,ts,color=Niagara Green,thickness=3
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.
The TimeSeriesAnalysis[Optimize] command was introduced in Maple 18.
For more information on Maple 18 changes, see Updates in Maple 18.
See Also
Initialize
LogLikelihood
Specialize
Download Help Document