Overload List
| # | Signature | Description |
|---|---|---|
| 1 | void SingleExpForecast(TVec Y, TVec YHat, Double Alpha, Int32 T, Int32 InitMethod) | Single exponential forecast. |
| 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. |
Overload 1: void SingleExpForecast(TVec Y, TVec YHat, Double Alpha, Int32 T, Int32 InitMethod)
Single exponential forecast.
| # | Name | Description |
|---|---|---|
| 1 | Y | Time series data set. |
| 2 | YHat | Time series forecasts. Size of the YHat vector are adjusted automatically. |
| 3 | Alpha | Overal smoothing parameter used for forecast. |
| 4 | T | Forecast values up to T period. |
| 5 | InitMethod | Defines 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:
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.
| # | Name | Description |
|---|---|---|
| 1 | MSE | MSE, evaluated at minimum. |
| 2 | Y | Time series data set. |
| 3 | YHat | Time series forecasts. Size of the YHat vector are adjusted automatically. |
| 4 | Alpha | Overal smoothing parameter used for forecast. |
| 5 | T | Forecast values up to T period. |
| 6 | InitMethod | Defines 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)
}
}