StatTimeSerAnalysis::ARARFit Function

void ARARFit(TVec *S, TVec *Phi, int &l1, int &l2, int &l3, double &Sigma2, const int MaxLag);

Fit ARAR algorithm.

#NameTypeDescription
1STVec *Memory-shortened time series. If no memory-shortening was performed, then S defines the original unshortened time series.
2PhiTVec *Returns ARAR model phi coefficients (phi[1],phi[l1],phi[l2],phi[l3]). Size of Phi vector is adjusted automatically (4).
3l1int &Returns ARAR model phil1 lag.
4l2int &Returns ARAR model phil2 lag.
5l3int &Returns ARAR model phil3 lag.
6Sigma2double &Returns ARAR model estimated WN variance.
7MaxLagconst intDefines upper limit for l3, where 1 < l1 < l2 < l3 <= MaxLag.
Remarks:

Fit ARAR algorithm to (optionaly) memory-shortened series. Let S[t] denote memory-shortened series, derived from Y[t] and let avg(S) denote sample mean of S[t]. The ARAR algorithm tries to fit an autoregressive (AR) process to the mean-corrected series:

X[t]=S[t]−⟨S⟩X[t] =S[t]-\langle S \rangle

The fitted model then has the form:

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]

where Z[t] is WN(0,sigma2).

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, s22;
    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::ARARForecast, StatTimeSerAnalysis::ShortenFilter
Declared in Dew::Stats::Units::StatTimeSerAnalysis · Dew.Stats/Units.StatTimeSerAnalysis.h · Cross-compiler