NAG Library Routine Document
G13AHF
1 Purpose
G13AHF produces forecasts of a time series, given a time series model which has already been fitted to the time series using
G13AEF or
G13AFF. The original observations are not required, since G13AHF uses as input either the original state set produced by
G13AEF or
G13AFF or the state set updated by a series of new observations using
G13AGF. Standard errors of the forecasts are also provided.
2 Specification
SUBROUTINE G13AHF ( |
ST, NST, MR, PAR, NPAR, C, RMS, NFV, FVA, FSD, WA, NWA, IFAIL) |
INTEGER |
NST, MR(7), NPAR, NFV, NWA, IFAIL |
REAL (KIND=nag_wp) |
ST(NST), PAR(NPAR), C, RMS, FVA(NFV), FSD(NFV), WA(NWA) |
|
3 Description
The original time series is
, for
and parameters have been fitted to the model of this time series using
G13AEF or
G13AFF.
Forecasts of
, for
, are calculated in five stages, as follows:
(i) |
set for , where is the number of differenced values in the series; |
(ii) |
calculate the values of , for , and ; |
(iii) |
calculate the values of , for , where and for are the first values in the state set, corrected for the constant; |
(iv) |
add the constant term to give the differenced series , for ; |
(v) |
the differencing operations are reversed to reconstitute , for . |
The standard errors of these forecasts are given by , for , where , is the residual variance of , and is the coefficient expressing the dependence of on .
To calculate , for , 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 , and , for .
The resulting quantities corresponding to the sequence are precisely , .
The supplied time series model is used throughout these calculations, with the exception that the constant term is taken to be zero.
4 References
None.
5 Parameters
- 1: – REAL (KIND=nag_wp) arrayInput
-
On entry: the state set derived from
G13AEF or
G13AFF originally, or as modified using earlier calls of
G13AGF.
- 2: – INTEGERInput
-
On entry: the number of values in the state set array
ST.
Constraint:
. (As returned by
G13AEF or
G13AFF).
- 3: – INTEGER arrayInput
-
On entry: the orders vector of the ARIMA model, in the usual notation.
Constraints:
- ;
- ;
- ;
- if , ;
- if , .
- 4: – REAL (KIND=nag_wp) arrayInput
-
On entry: the estimates of the
values of the
parameters, the
values of the
parameters, the
values of the
parameters and the
values of the
parameters which specify the model and which were output originally by
G13AEF or
G13AFF.
- 5: – INTEGERInput
-
On entry: the number of , , and parameters in the model.
Constraint:
.
- 6: – REAL (KIND=nag_wp)Input
-
On entry:
, the value of the model constant. This will have been output by
G13AEF or
G13AFF.
- 7: – REAL (KIND=nag_wp)Input
-
On entry:
, the residual variance associated with the model.
If
G13AFF was used to estimate the model,
RMS should be set to
, where
S and
NDF were output by
G13AFF.
If
G13AEF was used to estimate the model,
RMS should be set to
, where
S and
were output by
G13AEF.
Constraint:
.
- 8: – INTEGERInput
-
On entry: , the required number of forecasts.
Constraint:
.
- 9: – REAL (KIND=nag_wp) arrayOutput
-
On exit:
NFV forecast values relating to the original undifferenced series.
- 10: – REAL (KIND=nag_wp) arrayOutput
-
On exit: the standard errors associated with each of the
NFV forecast values in
FVA.
- 11: – REAL (KIND=nag_wp) arrayWorkspace
- 12: – INTEGERInput
-
On entry: the dimension of the array
WA as declared in the (sub)program from which G13AHF is called.
Constraint:
.
- 13: – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
-
On entry, | , |
or | the orders vector MR is invalid (check the constraints given in Section 5). |
-
On entry, | . |
-
-
On entry, | . |
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.8 in the Essential Introduction for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.7 in the Essential Introduction for further information.
Dynamic memory allocation failed.
See
Section 3.6 in the Essential Introduction for further information.
7 Accuracy
The computations are believed to be stable.
8 Parallelism and Performance
Not applicable.
The time taken by G13AHF is approximately proportional to .
10 Example
The following program is based on the data derived in the example used to illustrate
G13AGF.
These consist of a set of orders indicating that there are two moving average parameters (one non-seasonal, and one seasonal with periodicity ).
The model constant is zero.
The state set contains values.
In addition the residual mean-square derived when the model was originally fitted is given.
Twelve forecasts and their associated errors are obtained.
10.1 Program Text
Program Text (g13ahfe.f90)
10.2 Program Data
Program Data (g13ahfe.d)
10.3 Program Results
Program Results (g13ahfe.r)