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

NAG Library Routine Document

G13BBF

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

G13BBF filters a time series by a transfer function model.

2  Specification

SUBROUTINE G13BBF ( Y, NY, MR, NMR, PAR, NPAR, CY, WA, IWA, B, NB, IFAIL)
INTEGER  NY, MR(NMR), NMR, NPAR, IWA, NB, IFAIL
REAL (KIND=nag_wp)  Y(NY), PAR(NPAR), CY, WA(IWA), B(NB)

3  Description

From a given series y1,y2,,yn a new series b1,b2,,bn is calculated using a supplied (filtering) transfer function model according to the equation
bt=δ1bt-1+δ2bt-2++δpbt-p+ω0yt-b-ω1yt-b-1--ωqyt-b-q. (1)
As in the use of G13BAF, large transient errors may arise in the early values of bt due to ignorance of yt for t<0, and two possibilities are allowed.
(i) The equation (1) is applied from t=1+b+q,,n so all terms in yt on the right-hand side of (1) are known, the unknown set of values bt for t=b+q,,b+q+1-p being taken as zero.
(ii) The unknown values of yt for t0 are estimated by backforecasting exactly as for G13BAF.

4  References

Box G E P and Jenkins G M (1976) Time Series Analysis: Forecasting and Control (Revised Edition) Holden–Day

5  Parameters

1:     Y(NY) – REAL (KIND=nag_wp) arrayInput
On entry: the Qy backforecasts starting with backforecast at time 1-Qy to backforecast at time 0 followed by the time series starting at time 1, where Qy=MR6+MR9×MR10. If there are no backforecasts either because the ARIMA model for the time series is not known or because it is known but has no moving average terms, then the time series starts at the beginning of Y.
2:     NY – INTEGERInput
On entry: the total number of backforecasts and time series data points in array Y.
Constraint: NYmax1+Qy,NPAR.
3:     MR(NMR) – INTEGER arrayInput
On entry: the orders vector for the filtering transfer function model followed by the orders vector for the ARIMA model for the time series if the latter is known. The transfer function model orders appear in the standard form b,q,p as given in the G13 Chapter Introduction. Note that if the ARIMA model for the time series is supplied then the routine will assume that the first Qy values of the array Y are backforecasts.
Constraints:
the filtering model is restricted in the following way:
  • MR1, ​MR2, ​MR30.
the ARIMA model for the time series is restricted in the following ways:
  • MRk0, for k=4,5,,10;
  • if MR10=0, MR7+MR8+MR9=0;
  • if MR100, MR7+MR8+MR90;
  • MR101.
4:     NMR – INTEGERInput
On entry: the number of values supplied in the array MR. It takes the value 3 if no ARIMA model for the time series is supplied but otherwise it takes the value 10. Thus NMR acts as an indicator as to whether backforecasting can be carried out.
Constraint: NMR=3 or 10.
5:     PAR(NPAR) – REAL (KIND=nag_wp) arrayInput
On entry: the parameters of the filtering transfer function model followed by the parameters of the ARIMA model for the time series. In the transfer function model the parameters are in the standard order of MA-like followed by AR-like operator parameters. In the ARIMA model the parameters are in the standard order of non-seasonal AR and MA followed by seasonal AR and MA.
6:     NPAR – INTEGERInput
On entry: the total number of parameters held in array PAR.
Constraints:
  • if NMR=3, NPAR=MR2+MR3+1;
  • if NMR=10, NPAR=MR2+MR3+1+MR4+MR6+MR7+MR9.
7:     CY – REAL (KIND=nag_wp)Input
On entry: if the ARIMA model is known (i.e., NMR=10), CY must specify the constant term of the ARIMA model for the time series. If this model is not known (i.e., NMR=3) then CY is not used.
8:     WA(IWA) – REAL (KIND=nag_wp) arrayWorkspace
9:     IWA – INTEGERInput
On entry: the dimension of the array WA as declared in the (sub)program from which G13BBF is called.
Constraints:
let K=MR3+MR4+MR5+MR7+MR8×MR10,
then
  • if NMR=3, IWAMR1+NPAR;
  • if NMR=10, IWAMR1+NPAR+K×K+2.
10:   B(NB) – REAL (KIND=nag_wp) arrayOutput
On exit: the filtered output series. If the ARIMA model for the time series was known, and hence Qy backforecasts were supplied in Y, then B contains Qy ‘filtered’ backforecasts followed by the filtered series. Otherwise, the filtered series begins at the start of B just as the original series began at the start of Y. In either case, if the value of the series at time t is held in Yt, then the filtered value at time t is held in Bt.
11:   NB – INTEGERInput
On entry: the dimension of the array B as declared in the (sub)program from which G13BBF is called.
In addition to holding the returned filtered series, B is also used as an intermediate work array if the ARIMA model for the time series is known.
Constraints:
  • if NMR=3, NBNY;
  • if NMR=10, NBNY+maxMR1+MR2,MR3.
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,NMR3 and NMR10,
orMRi<0, for i=1,2,,NMR,
orNMR=10 and MR10=1,
orNMR=10 and MR10=0 and MR7+MR8+MR90,
orNMR=10 and MR100, and MR7+MR8+MR9=0,
orNPAR is inconsistent with the contents of MR,
orWA is too small,
orB is too small.
IFAIL=2
A supplied model has parameter values which have failed the validity test.
IFAIL=3
The supplied time series is too short to carry out the requested filtering successfully.
IFAIL=4
This only occurs when an ARIMA model for the time series has been supplied. The matrix which is used to solve for the starting values for MA filtering is singular.
IFAIL=-999
Internal memory allocation failed.

7  Accuracy

Accuracy and stability are high except when the AR-like parameters are close to the invertibility boundary. All calculations are performed in basic precision except for one inner product type calculation which on machines of low precision is performed in additional precision.

8  Further Comments

If an ARIMA model is supplied, a local workspace array of fixed length is allocated internally by G13BBF. The total size of this array amounts to K integer elements, where K is the expression defined in the description of the parameter WA.
The time taken by G13BBF is roughly proportional to the product of the length of the series and number of parameters in the filtering model with appreciable increase if an ARIMA model is supplied for the time series.

9  Example

This example reads a time series of length 296. It reads one univariate ARIMA 1,1,0,0,1,1,12 model for the series and the 0,13,12 filtering transfer function model. 12 initial backforecasts are required and these are calculated by a call to G13AJF . The backforecasts are inserted at the start of the series and G13BBF is called to perform the filtering.

9.1  Program Text

Program Text (g13bbfe.f90)

9.2  Program Data

Program Data (g13bbfe.d)

9.3  Program Results

Program Results (g13bbfe.r)


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

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