StatTimeSerAnalysis.SingleExpForecast Method

Overload List

#SignatureDescription
1void SingleExpForecast(TVec Y, TVec YHat, Double Alpha, Int32 T, Int32 InitMethod)Single exponential forecast.
2void SingleExpForecast(TVec Y, TVec YHat, ref Double Alpha, Int32 T, ref Double MSE, Int32 InitMethod)rst estimate Alpha parameters by single smoothing and then use returned value to forecast up to T periods.

Overload 1: void SingleExpForecast(TVec Y, TVec YHat, Double Alpha, Int32 T, Int32 InitMethod)

Single exponential forecast.

#NameDescription
1YTime series data set.
2YHatTime series forecasts. Size of the YHat vector are adjusted automatically.
3AlphaOveral smoothing parameter used for forecast.
4TForecast values up to T period.
5InitMethodDefines how the initial values for S[0] are calculated.

Result: stored in self (calling object)

Remarks:

Forecasts time series values by using single exponential smoothing equations. For single exponential smoothing, the h period ahead forecast is given by:

F[t+h]=S[t].F[t+h] = S[t] \quad .
Examples
using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples
{
    private void Example()
    {
        Vector Data = new Vector(0);
        Vector YHat = new Vector(0);
        Vector Residuals = new Vector(0);
        int NumPoints = 20;
        Data.LoadFromFile("aerosol_particles.vec");
        // last point period = Data.Length-1 + NumPoints
        int T = Data.Length - 1 + NumPoints;
        StatTimeSerAnalysis.SingleExpForecast(Data, YHat, 0.33, T, 0);
        // YHat now stores estimates for YHat[1,...Length-1]
        // so, if we need residuals, we have to subtract
        // these values from y[1,...,Length-1)
        Residuals.Size(YHat);
        Residuals.Sub(Data, YHat, 1, 0, 0, YHat.Length);
    }
}
See Also: StatTimeSerAnalysis.SingleExpSmooth

Overload 2: void SingleExpForecast(TVec Y, TVec YHat, ref Double Alpha, Int32 T, ref Double MSE, Int32 InitMethod)

rst estimate Alpha parameters by single smoothing and then use returned value to forecast up to T periods.

#NameDescription
1MSEMSE, evaluated at minimum.
2YTime series data set.
3YHatTime series forecasts. Size of the YHat vector are adjusted automatically.
4AlphaOveral smoothing parameter used for forecast.
5TForecast values up to T period.
6InitMethodDefines how the initial values for S[0] are calculated.

Result: stored in self (calling object)

Remarks:

Use this routine if you don't know the best estimates for Alpha.

Examples
using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples
{
    private void Example()
    {
        Vector Data = new Vector(0);
        Vector YHat = new Vector(0);
        int NumPoints = 20;
        Data.LoadFromFile("aerosol_particles.vec");
        // last point period = Data.Length-1 + NumPoints
        int T = Data.Length-1+NumPoints;
        // initial alpha estimate = 0.6
        double alpha = 0.6;
        double mse;
        StatTimeSerAnalysis.SingleExpForecast(Data,YHat,ref alpha,T,out mse,0);
        // returs mse and estimated Alpha (from MLE)
    }
}