Dew Stats Master .NET
DoubleExpSmooth Routines
Summary
Double exponential smoothing.

Unit
StatTimeSerAnalysis

Declaration
Function DoubleExpSmooth(Y: TVec; S, B: TVec; var Alpha, Gamma: TSample; InitMethod: Integer = 0): 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. 
Alpha Defines initial estimate for Alpha, returns Alpha which minimizes MSE. 
Gamma Defines initial estimate for Gamma, returns Gamma which minimizes MSE. 
InitMethod Defines how the initial values for b[0] are calculated. 
Result
MSE, evaluated at minimum.
Description
Performs double exponential smoothing using the following equations:

Smoothing scheme begins by setting S[0] to Y[0] and b[0] to pne of the following choices:

Different initialization methods are controlled by the InitMethod parameter. Default value (0) uses first equation, setting it to (1) means the second equation will be used and setting it to (2) means the third equation will be used to initialize b[0].

The first smoothing equation adjusts S[i] directly for the trend of the previous period, b[i-1], by adding it to the last smoothed value, S[i-1]. This helps to eliminate the lag and brings S[i] to the appropriate base of the current value. The second smoothing equation then updates the trend, which is expressed as the difference between the last two values. The equation is similar to the basic form of single smoothing, but here applied to the updating of the trend.

Categories
Time series analysis routines
 See Also 
DoubleExpForecast 

Example 1

Load data, perform smoothing and read Alpha,Gamma + MSE.
Uses MtxExpr, StatTimeSerAnalysis, Math387; procedure Example; var Data,S,b: Vector Alpha,Gamma,MSE: TSample; begin Data.LoadFromFile('aerosol_particles.vec'); // smooth data, initial alpha = 0.1, gamma = 0.3 Alpha := 0.1; Gamma := 0.3; MSE := DoubleExpSmooth(Data,S,Alpha,Gamma,1); // results: MSE and MLE estimate for Alpha,Gamma end;
#include "MtxVecCpp.h" #include "Math387.hpp" #include "StatTimeSerAnalysis.hpp" void __fastcall Example(); { Vector Data, S, b; Data->LoadFromFile("aerosol_particles.vec"); // smooth data, initial alpha = 0.1, gamma = 0.3 double alpha = 0.1; double gamma = 0.3; double MSE = DoubleExpSmooth(Data,S,alpha,gamma,1); // results: MSE and MLE estimate for alpha,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); Data.LoadFromFile("aerosol_particles.vec"); // smooth data, initial alpha = 0.1, gamma = 0.3 double alpha = 0.1; double gamma = 0.3; double MSE = DoubleExpSmooth(Data,S,ref alpha,ref gamma,1); // results: MSE and MLE estimate for alpha,gamma } }


Declaration
Procedure DoubleExpSmooth(Y: TVec; S, B: TVec; const Alpha, Gamma: TSample; out MSE: TSample; InitMethod: Integer = 0);
 Parameter  Description 
MSE Returns MSE, evaluated for constant Alpha and Gamma. 

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

Example 1

Load data, perform smoothing with Alpha = 0.2, Gamma = 0.18
Uses MtxExpr, StatTimeSerAnalysis, Math387; procedure Example; var Data,S,b: Vector; MSE: TSample; begin Data.LoadFromFile('aerosol_particles.vec'); // smooth data with Alpha=0.2, Gamma=0.18 DoubleExpSmooth(Data,S,0.2,0.18,MSE,1); // results: MSE end;
#include "MtxVecCpp.h" #include "Math387.hpp" #include "StatTimeSerAnalysis.hpp" void __fastcall Example(); { Vector Data, S, b; double MSE; Data->LoadFromFile("aerosol_particles.vec"); // smooth data with Alpha=0.2, Gamma=0.18 DoubleExpSmooth(Data,S,0.2,0.18,MSE,1); // results: MSE }
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); Data.LoadFromFile("aerosol_particles.vec"); // smooth data with Alpha=0.2, Gamma=0.18 double MSE; StatTimeSerAnalysis.DoubleExpSmooth(Data,S,0.2,0.18,out MSE,1); } }

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