Overload List
| # | Signature | Description |
|---|---|---|
| 1 | void SingleExpForecast(TVec *Y, TVec *YHat, const double Alpha, const int T, const int InitMethod = 0); | Single exponential forecast. |
| 2 | void SingleExpForecast(TVec *Y, TVec *YHat, double &Alpha, const int T, double &MSE, const int InitMethod = 0); | 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, const double Alpha, const int T, const int InitMethod = 0);
Single exponential forecast.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Y | TVec * | Time series data set. |
| 2 | YHat | TVec * | Time series forecasts. Size of the YHat vector are adjusted automatically. |
| 3 | Alpha | const double | Overal smoothing parameter used for forecast. |
| 4 | T | const int | Forecast values up to T period. |
| 5 | InitMethod = 0 | const int | Defines how the initial values for S[0] are calculated. |
Remarks:
Forecasts time series values by using single exponential smoothing equations. For single exponential smoothing, the h period ahead forecast is given by:
Examples
#include "MtxExpr.h"
#include "Units.StatTimeSerAnalysis.h"
using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Stats;
using namespace Dew::Stats::Units::StatTimeSerAnalysis;
void Example()
{
Vector Data(0);
Vector YHat(0);
Vector Residuals(0);
int NumPoints = 20;
Data.LoadFromFile("aerosol_particles.vec");
// last point period = Data.Length-1 + NumPoints
int 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(Data.Length - 1);
Residuals.Sub(Data, YHat, 1, 0, 0, Data.Length - 1);
}
See Also: StatTimeSerAnalysis::SingleExpSmooth
Declared in Dew::Stats::Units::StatTimeSerAnalysis · Dew.Stats/Units.StatTimeSerAnalysis.h · Cross-compiler
Overload 2: void SingleExpForecast(TVec *Y, TVec *YHat, double &Alpha, const int T, double &MSE, const int InitMethod = 0);
rst estimate Alpha parameters by single smoothing and then use returned value to forecast up to T periods.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Y | TVec * | Time series data set. |
| 2 | YHat | TVec * | Time series forecasts. Size of the YHat vector are adjusted automatically. |
| 3 | Alpha | double & | Overal smoothing parameter used for forecast. |
| 4 | T | const int | Forecast values up to T period. |
| 5 | MSE | double & | MSE, evaluated at minimum. |
| 6 | InitMethod = 0 | const int | Defines how the initial values for S[0] are calculated. |
Remarks:
Use this routine if you don't know the best estimates for Alpha.
Examples
#include "MtxExpr.h"
#include "Units.StatTimeSerAnalysis.h"
using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Stats;
using namespace Dew::Stats::Units::StatTimeSerAnalysis;
void Example()
{
Vector Data(0);
Vector YHat(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;
SingleExpForecast(Data,YHat,alpha,T,mse,0);
// returs mse and estimated Alpha (from MLE)
}
Declared in Dew::Stats::Units::StatTimeSerAnalysis · Dew.Stats/Units.StatTimeSerAnalysis.h · Cross-compiler