g13ah produces forecasts of a time series, given a time series model which has already been fitted to the time series using (G13AEF not in this release) g13af. The original observations are not required, since g13ah uses as input either the original state set produced by (G13AEF not in this release) g13af or the state set updated by a series of new observations using g13ag. Standard errors of the forecasts are also provided.

Syntax

C#
public static void g13ah(
	double[] st,
	int nst,
	int[] mr,
	double[] par,
	double c,
	double rms,
	int nfv,
	double[] fva,
	double[] fsd,
	out int ifail
)
Visual Basic
Public Shared Sub g13ah ( _
	st As Double(), _
	nst As Integer, _
	mr As Integer(), _
	par As Double(), _
	c As Double, _
	rms As Double, _
	nfv As Integer, _
	fva As Double(), _
	fsd As Double(), _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g13ah(
	array<double>^ st, 
	int nst, 
	array<int>^ mr, 
	array<double>^ par, 
	double c, 
	double rms, 
	int nfv, 
	array<double>^ fva, 
	array<double>^ fsd, 
	[OutAttribute] int% ifail
)
F#
static member g13ah : 
        st : float[] * 
        nst : int * 
        mr : int[] * 
        par : float[] * 
        c : float * 
        rms : float * 
        nfv : int * 
        fva : float[] * 
        fsd : float[] * 
        ifail : int byref -> unit 

Parameters

st
Type: array<System..::..Double>[]()[][]
An array of size [nst]
On entry: the state set derived from (G13AEF not in this release) g13af originally, or as modified using earlier calls of g13ag.
nst
Type: System..::..Int32
On entry: the number of values in the state set array st.
Constraint: nst=P×s+D×s+d+q+maxp,Q×s. (As returned by (G13AEF not in this release) g13af).
mr
Type: array<System..::..Int32>[]()[][]
An array of size [7]
On entry: the orders vector p,d,q,P,D,Q,s of the ARIMA model, in the usual notation.
Constraints:
  • p,d,q,P,D,Q,s0;
  • p+q+P+Q>0;
  • s1;
  • if s=0, P+D+Q=0;
  • if s>1, P+D+Q>0.
par
Type: array<System..::..Double>[]()[][]
An array of size [dim1]
Note: dim1 must satisfy the constraint: _npar=p+q+P+Q
On entry: the estimates of the p values of the ϕ parameters, the q values of the θ parameters, the P values of the Φ parameters and the Q values of the Θ parameters which specify the model and which were output originally by (G13AEF not in this release) g13af.
c
Type: System..::..Double
On entry: c, the value of the model constant. This will have been output by (G13AEF not in this release) g13af.
rms
Type: System..::..Double
On entry: V, the residual variance associated with the model.
If g13af was used to estimate the model, rms should be set to s/ndf, where s and ndf were output by g13af.
If (G13AEF not in this release) was used to estimate the model, rms should be set to s/icount[4], where s and icount[4] were output by (G13AEF not in this release).
Constraint: rms0.0.
nfv
Type: System..::..Int32
On entry: L, the required number of forecasts.
Constraint: nfv>0.
fva
Type: array<System..::..Double>[]()[][]
An array of size [nfv]
On exit: nfv forecast values relating to the original undifferenced series.
fsd
Type: array<System..::..Double>[]()[][]
An array of size [nfv]
On exit: the standard errors associated with each of the nfv forecast values in fva.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Description

The original time series is xt, for t=1,2,,n and parameters have been fitted to the model of this time series using (G13AEF not in this release) g13af.
Forecasts of xt, for t=n+1,,n+L, are calculated in five stages, as follows:
(i) set at=0 for t=N+1,N+2,,N+L, where N=n-d-D×s is the number of differenced values in the series;
(ii) calculate the values of et, for t=N+1,,N+L, and et=ϕ1×et-1++ϕp×et-p+at-θ1×at-1--θq×at-q;
(iii) calculate the values of wt, for t=N+1,,N+L, where wt=Φ1×wt-s++ΦP×wt-s×P+et-Θ1×et-s--ΘQ×et-s×Q and wt for tN are the first s×P values in the state set, corrected for the constant;
(iv) add the constant term c to give the differenced series dsDxt=wt+c, for t=N+1,,N+L;
(v) the differencing operations are reversed to reconstitute xt, for t=n+1,,n+L.
The standard errors of these forecasts are given by st=V×ψ02+ψ12++ψt-n-121/2, for t=n+1,,n+L, where ψ0=1, V is the residual variance of at, and ψj is the coefficient expressing the dependence of xt on at-j.
To calculate ψj, for j=1,2,,L-1, the following device is used.
A copy of the state set is initialized to zero throughout and the calculations outlined above for the construction of forecasts are carried out with the settings aN+1=1, and at=0, for t=N+2,,N+L.
The resulting quantities corresponding to the sequence xN+1,xN+2,,xN+L are precisely 1, ψ1,ψ2,,ψL-1.
The supplied time series model is used throughout these calculations, with the exception that the constant term c is taken to be zero.

References

None.

Error Indicators and Warnings

Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (NPAR) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
ifail=1
On entry,the orders vector mr is invalid (check the constraints given in [Parameters]).
ifail=2
On entry,nstP×s+D×s+d+q+maxQ×s,p.
ifail=3
On entry,nfv0.
ifail=5
On entry,rms<0.0.
ifail=-9000
An error occured, see message report.
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value

Accuracy

The computations are believed to be stable.

Parallelism and Performance

None.

Further Comments

The time taken by g13ah is approximately proportional to nfv×_npar.

Example

These consist of a set of orders indicating that there are two moving average parameters (one non-seasonal, and one seasonal with periodicity 12).
The model constant is zero.
The state set contains 26 values.
In addition the residual mean-square derived when the model was originally fitted is given.
Twelve forecasts and their associated errors are obtained.

Example program (C#): g13ahe.cs

Example program data: g13ahe.d

Example program results: g13ahe.r

See Also