G13AGF (PDF version)
G13 Chapter Contents
G13 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

G13AGF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

G13AGF accepts a series of new observations of a time series, the model of which is already fully specified, and updates the ‘state set’ information for use in constructing further forecasts. The previous specifications of the time series model should have been obtained by using G13AEF or G13AFF to estimate the relevant parameters. The supplied state set will originally have been produced by G13AEF or G13AFF, but may since have been updated by earlier calls to G13AGF.
A set of residuals corresponding to the new observations is returned. These may be of use in checking that the new observations conform to the previously fitted model.

2  Specification

SUBROUTINE G13AGF ( ST, NST, MR, PAR, NPAR, C, ANX, NUV, ANEXR, WA, NWA, IFAIL)
INTEGER  NST, MR(7), NPAR, NUV, NWA, IFAIL
REAL (KIND=nag_wp)  ST(NST), PAR(NPAR), C, ANX(NUV), ANEXR(NUV), WA(NWA)

3  Description

The time series model is specified as outlined in Section 3 in G13AEF or G13AFF. This also describes how the state set, which contains the minimum amount of time series information needed to construct forecasts, is made up of
(i) the differenced series wt (uncorrected for the constant c), for N-P×s<tN,
(ii) the d values required to reconstitute the original series xt from the differenced series wt,
(iii) the intermediate series et, for N - maxp, Q × s < t N , and
(iv) the residual series at, for N-q<tN.
If the number of original undifferenced observations was n, then d=d+D×s and N=n-d.
To update the state set, given a number of new undifferenced observations xt, t=n+1,n+2,,n+k, the four series above are first reconstituted.
Differencing and residual calculation operations are then applied to the new observations and k new values of wt,et and at are derived.
The first k values in these three series are then discarded and a new state set is obtained.
The residuals in the at series corresponding to the k new observations are preserved in an output array. The parameters of the time series model are not changed in this routine.

4  References

None.

5  Parameters

1:     STNST – REAL (KIND=nag_wp) arrayInput/Output
On entry: the state set derived from G13AEF or G13AFF, or as modified using earlier calls of G13AGF.
On exit: the updated values of the state set.
2:     NST – INTEGERInput
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 or G13AFF).
3:     MR7 – INTEGER arrayInput
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.
4:     PARNPAR – REAL (KIND=nag_wp) arrayInput
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 in the model – in that order, using the usual notation.
5:     NPAR – INTEGERInput
On entry: the number of ϕ, θ, Φ and Θ parameters in the model.
Constraint: NPAR=p+q+P+Q.
6:     C – REAL (KIND=nag_wp)Input
On entry: the constant to be subtracted from the differenced data.
7:     ANXNUV – REAL (KIND=nag_wp) arrayInput
On entry: the new undifferenced observations which are to be used to update ST.
8:     NUV – INTEGERInput
On entry: k, the number of new observations in ANX.
9:     ANEXRNUV – REAL (KIND=nag_wp) arrayOutput
On exit: the residuals corresponding to the new observations in ANX.
10:   WANWA – REAL (KIND=nag_wp) arrayWorkspace
11:   NWA – INTEGERInput
On entry: the dimension of the array WA as declared in the (sub)program from which G13AGF is called.
Constraint: NWA4×NPAR+3×NST.
12:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. 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 -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=1
On entry,NPARp+q+P+Q,
orthe orders vector MR is invalid (check the constraints in Section 5).
IFAIL=2
On entry,NSTP×s+D×s+d+q+maxQ×s,p.
IFAIL=3
On entry,NUV0.
IFAIL=4
On entry,NWA<4×NPAR+3×NST.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
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.

9  Further Comments

The time taken by G13AGF is approximately proportional to NUV×NPAR.

10  Example

The following program is based on data derived from a study of monthly airline passenger totals (in thousands) to which a logarithmic transformation had been applied. The time series model was based on seasonal and non-seasonal differencing both of order 1, with seasonal period 12. The number of parameters estimated was two: a non-seasonal moving average parameter θ1 with value 0.327 and a seasonal moving average parameter Θ1 with value 0.6270. There was no constant correction. These, together with the state set array, were obtained using G13AEF.
Twelve new observations are supplied. The routine updates the state set and outputs a set of residuals corresponding to the new observations.

10.1  Program Text

Program Text (g13agfe.f90)

10.2  Program Data

Program Data (g13agfe.d)

10.3  Program Results

Program Results (g13agfe.r)


G13AGF (PDF version)
G13 Chapter Contents
G13 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2015