Overload List
| # | Signature | Description |
|---|---|---|
| 1 | procedure SingleExpForecast(const Y: TVec; const YHat: TVec; const Alpha: Double; const T: Integer; const InitMethod: Integer); | Single exponential forecast. |
| 2 | procedure SingleExpForecast(const Y: TVec; const YHat: TVec; var Alpha: Double; const T: Integer; out MSE: Double; const InitMethod: Integer); | rst estimate Alpha parameters by single smoothing and then use returned value to forecast up to T periods. |
Overload 1: procedure SingleExpForecast(const Y: TVec; const YHat: TVec; const Alpha: Double; const T: Integer; const InitMethod: Integer);
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
Uses MtxExpr, StatTimeSerAnalysis, Math387;
procedure Example;
var Data,YHat: Vector;
T: Integer;
NumPoints: Integer;
Residuals: TVec;
begin
NumPoints := 20;
Data.LoadFromFile('aerosol_particles.vec');
// last point period = Data.Length-1 + NumPoints
T := Data.Length-1+NumPoints;
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(Y,YHat,1,0,0,YHat.Length);
end;
See Also: StatTimeSerAnalysis.SingleExpSmooth
Overload 2: procedure SingleExpForecast(const Y: TVec; const YHat: TVec; var Alpha: Double; const T: Integer; out MSE: Double; const InitMethod: Integer);
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
Uses MtxExpr, StatTimeSerAnalysis, Math387;
procedure Example;
var Data,YHat: Vector;
Alpha: double;
T, NumPoints: Integer;
begin
NumPoints := 20;
Data.LoadFromFile('aerosol_particles.vec');
// last point period = Data.Length-1 + NumPoints
T := Data.Length-1+NumPoints;
// initial Alpha estimate = 0.6
Alpha := 0.6;
SingleExpForecast(Data,YHat,Alpha,T,MSE,0);
// returs MSE and estimated Alpha (from MLE)
end;