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: ST(NST) – 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: NST – INTEGERInput
On entry: the number of values in the state set array
ST.
Constraint:
. (As returned by
G13AEF or
G13AFF).
- 3: MR() – INTEGER arrayInput
On entry: the orders vector of the ARIMA model, in the usual notation.
Constraints:
- ;
- ;
- ;
- if , ;
- if , .
- 4: PAR(NPAR) – 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: NPAR – INTEGERInput
On entry: the number of , , and parameters in the model.
Constraint:
.
- 6: C – REAL (KIND=nag_wp)Input
On entry:
, the value of the model constant. This will have been output by
G13AEF or
G13AFF.
- 7: RMS – 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: NFV – INTEGERInput
On entry: , the required number of forecasts.
Constraint:
.
- 9: FVA(NFV) – REAL (KIND=nag_wp) arrayOutput
On exit:
NFV forecast values relating to the original undifferenced series.
- 10: FSD(NFV) – REAL (KIND=nag_wp) arrayOutput
On exit: the standard errors associated with each of the
NFV forecast values in
FVA.
- 11: WA(NWA) – REAL (KIND=nag_wp) arrayWorkspace
- 12: NWA – INTEGERInput
On entry: the dimension of the array
WA as declared in the (sub)program from which G13AHF is called.
Constraint:
.
- 13: IFAIL – 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, | . |
7 Accuracy
The computations are believed to be stable.
The time taken by G13AHF is approximately proportional to .
9 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.
9.1 Program Text
Program Text (g13ahfe.f90)
9.2 Program Data
Program Data (g13ahfe.d)
9.3 Program Results
Program Results (g13ahfe.r)