Dew Stats Master .NET
ARARForecast Routine
Summary
Forecast time series by ARAR.

Unit
StatTimeSerAnalysis

Declaration
Procedure ARARForecast(Data: TVec; Phi, Filter: TVec; tau, l1, l2, l3: Integer; SMean: TSample; n: Integer; Result, StdErrs: TVec; out RMSE: TSample);
 Parameter  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. 
Result 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. 
MSE Returns fit root mean square error (RMSE). 

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

Categories
Time series analysis routines
ARMA and ARIMA routines
 See Also 
ARARFit 
ShortenFilter 

Example 1

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: TSample; 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 "MtxVecCpp.h" #include "StatTimeSerAnalysis.hpp" void __fastcall Example(); { Vector timeseries,s,filter,phi,forecasts,stderrs; int l1,l2,l3,tau; double s2; 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(),s2,100,forecasts,stderrs,rmse); }
using Dew.Math; using Dew.Stats; using Dew.Stats.Units; namespace Dew.Examples { private void Example() { Vector timeseries = new Vector(0); Vector s = new Vector(0); Vector filter = new Vector(0); Vector phi = new Vector(0); Vector forecasts = new Vector(0); Vector stderrs = new Vector(0); int l1,l2,l3,tau; double s2, rmse; timeseries.LoadFromFile("deaths.vec"); // #1: shorten series StatTimeSerAnalysis.ShortenFilter(timeSeries,s,tau,Filter); // #2 : fit ARAR model on shortened series StatTimeSerAnalysis.ARARFit(s,Phi,out l1,out l2,out l3,out s2,13); // #3: forecast 100 values by using ARAR fit parameters StatTimeSerAnalysis.ARARForecast(timeseries,Phi,Filter,tau,l1,l2,l3,s.Mean(),s2,100,forecasts,stderrs,out rmse); } }

Copyright 2008 Dew Research
http://www.dewresearch.com