Dew Stats Master .NET
TripleExpSmooth Routines
Summary
Triple exponential smoothing.

Unit
StatTimeSerAnalysis

Declaration
Function TripleExpSmooth(Y: TVec; S, B, L: TVec; var Alpha, Beta, Gamma: TSample; const Period: Integer): TSample;
 Parameter  Description 
Time series data set. 
Smoothed values (see above equation). Size and complex properties of S are set automatically. 
Trend values (see above equation). Size and complex properties of b are set automatically. 
Seasonal indices (see above equation). Size and complex properties of L are set automatically. 
Alpha Defines initial estimate for Alpha, returns Alpha which minimizes MSE. 
Beta Defines initial estimate for Beta, returns Beta which minimizes MSE. 
Gamma Defines initial estimate for Gamma, returns Gamma which minimizes MSE. 
Period Period length. An exception is raised if Y.Length mod Period is not 0. 
Result
MSE, evaluated at minimum.
Description
Performs double exponential smoothing (also known as Holt-Winters smoothing) using the following equations:

where Y are the observations, S are the smoothed observations, b trend factors, L the seasonal indices and P is the period length. To initialize triple exponential smoothing method we need at least one complete season's data to determine initial estimates of the seasonal indices L[0]..L[P-1]. Again, there are several ways to initialize L values. The algorithm uses approach, described at NIST pages. For initial estimate for S and b, the following equations are being used:

Please note that there are no S[0]..S[P-2]; the smoothed series starts with the smoothed version of the Y[P] observation. Also note that the internal algorithm automatically accounts for this by resizing S,b vector to Y.Length-Period.

Categories
Time series analysis routines
 See Also 
TripleExpForecast 

Example 1

Generate 24 random values representing 4 quarters x 6 years = 24, perform smoothing and read Alpha,Beta,Gamma + MSE.
Uses MtxExpr,StatTimeSerAnalysis, Math387; procedure Example; var Data,S,b,L: Vector; Alpha,Beta,Gamma,MSE: TSample; begin Data.Size(24,false); Data.RandGauss; // smooth data, initial alpha = 0.1, beta=0.1, gamma = 0.3 Alpha := 0.1; Beta := 0.1; Gamma := 0.3; // Period = 4 MSE := TripleExpSmooth(Data,S,Alpha,BetamGamma,4); // results: MSE and MLE estimate for Alpha,Beta,Gamma end;
#include "MtxVecCpp.h" #include "Math387.hpp" #include "StatTimeSerAnalysis.hpp" void __fastcall Example(); { Vector Data,S,b,L; Data->Size(24,false); Data->RandGauss(); // smooth data, initial alpha = 0.1, beta=0.1, gamma = 0.3 double alpha = 0.1; double beta = 0.1; double gamma = 0.3; // Period = 4 double MSE = TripleExpSmooth(Data,S,alpha,beta,gamma,4); // results: MSE and MLE estimate for Alpha,Beta,Gamma }
using Dew.Math; using Dew.Stats; using Dew.Stats.Units; namespace Dew.Examples { private void Example() { Vector Data = new Vector(0); Vector S = new Vector(0); Vector b = new Vector(0); Vector L = new Vector(0); Data.Size(24,false); Data.RandGauss(); // smooth data, initial alpha = 0.1, beta=0.1, gamma = 0.3 double alpha = 0.1; double beta = 0.1; double gamma = 0.3; // Period = 4 double MSE = TripleExpSmooth(Data,S,ref alpha,ref beta, ref gamma,4); // results: MSE and MLE estimate for Alpha,Beta,Gamma } }


Declaration
Procedure TripleExpSmooth(Y: TVec; S, B, L: TVec; const Alpha, Beta, Gamma: TSample; out MSE: TSample; const Period: Integer);
 Parameter  Description 
MSE Returns MSE, evaluated for constant Alpha, Beta and Gamma. 

Description
In this case a fixed smoothing constants Alpha, Beta and Gamma are used in smoothing equations (no minimization is performed).

Copyright 2008 Dew Research
http://www.dewresearch.com