StatTimeSerAnalysis.DoubleExpSmooth Method

Overload List

#SignatureDescription
1void DoubleExpSmooth(TVec Y, TVec S, TVec B, Double Alpha, Double Gamma, ref Double MSE, Int32 InitMethod)In this case a fixed smoothing constants Alpha, Gamma are used in smoothing equations (no minimization is performed).
2Double DoubleExpSmooth(TVec Y, TVec S, TVec B, ref Double Alpha, ref Double Gamma, Int32 InitMethod)Double exponential smoothing.

Overload 1: void DoubleExpSmooth(TVec Y, TVec S, TVec B, Double Alpha, Double Gamma, ref Double MSE, Int32 InitMethod)

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

#NameDescription
1MSEReturns MSE, evaluated for constant Alpha and Gamma.
2YTime series data set.
3SSmoothed values (see above equation). Size and complex properties of S are set automatically.
4BTrend values (see above equation). Size and complex properties of b are set automatically.
5AlphaDefines initial estimate for Alpha, returns Alpha which minimizes MSE.
6GammaDefines initial estimate for Gamma, returns Gamma which minimizes MSE.
7InitMethodDefines how the initial values for b[0] are calculated.

Result: stored in self (calling object)

Examples
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,b,0.2,0.18,out MSE,1);
    }
}

Overload 2: Double DoubleExpSmooth(TVec Y, TVec S, TVec B, ref Double Alpha, ref Double Gamma, Int32 InitMethod)

Double exponential smoothing.

#NameDescription
1YTime series data set.
2SSmoothed values (see above equation). Size and complex properties of S are set automatically.
3BTrend values (see above equation). Size and complex properties of b are set automatically.
4AlphaDefines initial estimate for Alpha, returns Alpha which minimizes MSE.
5GammaDefines initial estimate for Gamma, returns Gamma which minimizes MSE.
6InitMethodDefines how the initial values for b[0] are calculated.

Returns: Double - MSE,evaluated at minimum.

Remarks:

Performs double exponential smoothing using the following equations:

S[i]=αY[i]+(1α)(S[i1]+b[i1]),0α1b[i]=γ(S[i]S[i1])+(1γ)b[i1],0γ1\begin{aligned} S[i] &= \alpha \cdot Y[i] + (1-\alpha)(S[i-1]+b[i-1]) \quad , \quad 0\leq \alpha \leq 1 \\ b[i] &= \gamma (S[i]-S[i-1])+(1-\gamma)b[i-1] \quad, \quad 0\leq \gamma \leq 1 \end{aligned}

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

b[0]=Y[1]Y[0]b[0]=13(Y[3]Y[0])b[0]=1n1(Y[n1]Y[0])\begin{aligned} b[0] &= Y[1]-Y[0] \\ b[0] &= \cfrac{1}{3}(Y[3]-Y[0]) \\ b[0] &= \cfrac{1}{n-1}\left(Y[n-1]-Y[0]\right) \end{aligned}

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.

Examples
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 = StatTimeSerAnalysis.DoubleExpSmooth(Data,S,b,ref alpha,ref gamma,1);
        // results: MSE and MLE estimate for alpha,gamma
    }
}
See Also: StatTimeSerAnalysis.DoubleExpForecast