NAG Library Routine Document
g13ahf (uni_arima_forecast_state)
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
Fortran Interface
Subroutine g13ahf ( |
st, nst, mr, par, npar, c, rms, nfv, fva, fsd, wa, nwa, ifail) |
Integer, Intent (In) | :: | nst, mr(7), npar, nfv, nwa | Integer, Intent (Inout) | :: | ifail | Real (Kind=nag_wp), Intent (In) | :: | st(nst), par(npar), c, rms | Real (Kind=nag_wp), Intent (Out) | :: | fva(nfv), fsd(nfv), wa(nwa) |
|
C Header Interface
#include <nagmk26.h>
void |
g13ahf_ (const double st[], const Integer *nst, const Integer mr[], const double par[], const Integer *npar, const double *c, const double *rms, const Integer *nfv, double fva[], double fsd[], double wa[], const Integer *nwa, Integer *ifail) |
|
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
Arguments
- 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 argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation 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 argument, 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, .
Constraint: .
The orders vector
mr is invalid.
-
On entry, .
Constraint: .
-
On entry, .
Constraint: .
-
On entry, and the minimum size .
Constraint: .
-
On entry, .
Constraint: .
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See
Section 3.7 in How to Use the NAG Library and its Documentation for further information.
7
Accuracy
The computations are believed to be stable.
8
Parallelism and Performance
g13ahf is not threaded in any implementation.
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)