StatTimeSerAnalysis::ARARForecast Function

void ARARForecast(TVec *Data, TVec *Phi, TVec *Filter, const int tau, const int l1, const int l2, const int l3, const double SMean, const int N, TVec *aResult, TVec *StdErrs, double &RMSE);

Forecast time series by ARAR.

#NameTypeDescription
1DataTVec *Defines original time series.
2PhiTVec *Defines ARAR model Phi coefficients (phi[0],phi[1],phi[2],phi[3]).
3FilterTVec *Defines memory shortening filter, obtained from memory-shortening operation. In case no memory-shortening is performed, set filter to 1.0 by using Filter.SetIt([1.0]).
4tauconst intDefines memory-shortening optimal lag, obtained from memory-shortening operation. In case no memory-shortening is performed, set it to 1.
5l1const intDefines optimal lag for phi[l1] (see equation above).
6l2const intDefines optimal lag for phi[l2] (see equation above).
7l3const intDefines optimal lag for phi[l3] (see equation above).
8SMeanconst doubleDefines memory-shortened series mean.
9Nconst intDefines number of forecasts.
10aResultTVec *Returns forecasts. Size and complex properties of Result are adjusted automatically.
11StdErrsTVec *Returns forecasts standard errors. Size and complex properties of StdErrs are adjusted automatically.
12RMSEdouble &Returns fit root mean square error (RMSE).
Remarks:

Forecast time series values by using ARAR model, defined by the following relation:

X[t]=ϕ1X[t−1]+ϕl1X[t−l1]+ϕl2X[t−l2]+ϕl3X[t−l3]+Z[t]X[t] =\phi _1 X[t-1] + \phi _{l1} X[t-l1] + \phi _{l2} X[t-l2] + \phi _{l3} X[t-l3] + Z[t]
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 timeseries(0);
    Vector s(0);
    Vector filter(0);
    Vector phi(0);
    Vector forecasts(0);
    Vector stderrs(0);
    int l1, l2, l3, tau;
    double s2, rmse;
    timeseries.LoadFromFile("deaths.vec");
    // #1: shorten series
    ShortenFilter(timeseries, s, tau, filter, 15);
    // #2 : fit ARAR model on shortened series
    ARARFit(s, phi, l1, l2, l3, s2, 13);
    // #3: forecast 100 values by using ARAR fit parameters
    ARARForecast(timeseries, phi, filter, tau, l1, l2, l3, s.Mean(), 100, forecasts, stderrs, rmse);
}
See Also: StatTimeSerAnalysis::ARARFit, StatTimeSerAnalysis::ShortenFilter
Declared in Dew::Stats::Units::StatTimeSerAnalysis · Dew.Stats/Units.StatTimeSerAnalysis.h · Cross-compiler