You are here: Symbol Reference > StatTimeSerAnalysis Namespace > Functions > StatTimeSerAnalysis.ARARForecast Function
Stats Master VCL
ContentsIndex
PreviousUpNext
StatTimeSerAnalysis.ARARForecast Function

Forecast time series by ARAR.

Pascal
procedure ARARForecast(const Data: TVec; const Phi: TVec; const Filter: TVec; const tau: Integer; const l1: Integer; const l2: Integer; const l3: Integer; const SMean: double; const N: Integer; const aResult: TVec; const StdErrs: TVec; out RMSE: double);
Parameters 
Description 
Data 
Defines original time series. 
Phi 
Defines ARAR model Phi coefficients (phi[0],phi[1],phi[2],phi[3]). 
Filter 
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]). 
tau 
Defines memory-shortening optimal lag, obtained from memory-shortening operation. In case no memory-shortening is performed, set it to 1. 
l1 
Defines optimal lag for phi[l1] (see equation above). 
l2 
Defines optimal lag for phi[l2] (see equation above). 
l3 
Defines optimal lag for phi[l3] (see equation above). 
SMean 
Defines memory-shortened series mean. 
Defines number of forecasts. 
aResult 
Returns forecasts. Size and complex properties of Result are adjusted automatically. 
StdErrs 
Returns forecasts standard errors. Size and complex properties of StdErrs are adjusted automatically. 
RMSE 
Returns fit root mean square error (RMSE). 

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

 

 

Fit and then forecast time series values by using ARAR algorithm. Before applying the ARAR algorithm, use the shortening filter on original series.

Uses MtxExpr, StatTimeSerAnalysis, Math387;
procedure Example;
var timeseries,s,filter,phi: Vector;
  forecasts,stderrs: Vector;
  l1,l2,l3,tau: Integer;
  s2,rmse: double;
 begin
   timeseries.LoadFromFile('deaths.vec');
   // #1: shorten series
   ShortenFilter(timeSeries,s,tau,Filter);
   // #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);
end;
#include "MtxExpr.hpp"
#include "StatTimeSerAnalysis.hpp"
void __fastcall Example();
{
    sVector timeseries,s,filter,phi,forecasts,stderrs;
    int l1,l2,l3,tau;
    double s2, rmse;
    timeseries.LoadFromFile("deaths.vec");
    // #1: shorten series
    ShortenFilter(timeseries,s,tau,filter);
    // #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);
}
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!