NAG Library Function Document

nag_tsa_transf_filter (g13bbc)

 Contents

    1  Purpose
    7  Accuracy

1
Purpose

nag_tsa_transf_filter (g13bbc) filters a time series by a transfer function model.

2
Specification

#include <nag.h>
#include <nagg13.h>
void  nag_tsa_transf_filter (const double y[], Integer ny, Nag_TransfOrder *transfv, Nag_ArimaOrder *arimas, const double par[], Integer npar, double cy, double b[], Integer nb, NagError *fail)

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 nag_tsa_arma_filter (g13bac), 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 nag_tsa_arma_filter (g13bac).

4
References

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

5
Arguments

1:     y[ny] const doubleInput
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=arimas.q+arimas.bigq×arimas.s. 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:     transfv Nag_TransfOrder *Input
On entry: the orders of the transfer function model where the triplet (transfv. nag_b, transfv. nag_q, transfv. nag_p) corresponds to the triplet b,q,p as described in Section 2.3.1 in the g13 Chapter Introduction.
Constraints:
  • transfv.nag_b0 ;
  • transfv.nag_q0 ;
  • transfv.nag_p0 .
4:     arimas Nag_ArimaOrder *Input
On entry: if available, the orders for the filtering ARIMA model for the time series as a pointer to structure of type Nag_ArimaOrder with the following members:
pInteger
dIntegerInput
qIntegerInput
bigpIntegerInput
bigdIntegerInput
bigqIntegerInput
sIntegerInput
On entry: these seven members of arimas must specify the orders vector p,d,q,P,D,Q,s, respectively, of the ARIMA model for the output noise component.
p, q, P and Q refer, respectively, to the number of autoregressive (ϕ), moving average (θ), seasonal autoregressive (Φ) and seasonal moving average (Θ) parameters.
d, D and s refer, respectively, to the order of non-seasonal differencing, the order of seasonal differencing and the seasonal period.
If no ARIMA model for the series is to be supplied arimas should be set to a NULL pointer.
Constraints:
  • arimas.p0 ;
  • arimas.d0 ;
  • arimas.q0 ;
  • arimas.bigp0 ;
  • arimas.bigd0 ;
  • arimas.bigq0 ;
  • arimas.s0 ;
  • arimas.s1 ;
  • if arimas.s=0, arimas.bigp+arimas.bigd+arimas.bigq=0 ;
  • if arimas.s0, arimas.bigp+arimas.bigd+arimas.bigq0 .
5:     par[npar] const doubleInput
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 arimasis notNULL, npar=transfv.nag_q+transfv.nag_p+1 ;
  • if arimasisNULL, npar=transfv.nag_q+transfv.nag_p+1+arimas.p+ arimas.q+arimas.bigp+arimas.bigq .
7:     cy doubleInput
On entry: if the ARIMA model is known (i.e., arimasisNULL), cy must specify the constant term of the ARIMA model for the time series. If this model is not known (i.e., arimasis notNULL) then cy is not used.
8:     b[nb] doubleOutput
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 y[t-1], then the filtered value at time t is held in b[t-1].
9:     nb IntegerInput
On entry: the dimension of the array b.
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 arimasis notNULL, nbny;
  • if arimasisNULL, nbny+maxtransfv.nag_b+transfv.nag_q,transfv.nag_p.
10:   fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

6
Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_ARRAY_SIZE
The array b is too small. Minimum required size: value.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_CONSTRAINT
Constraint: arimas.bigd0 .
Constraint: arimas.bigp0 .
Constraint: arimas.bigq0 .
Constraint: arimas.d0 .
Constraint: arimas.p0 .
Constraint: arimas.q0 .
Constraint: arimas.s1 .
Constraint: arimas.s0 .
Constraint: if arimas.s=0, arimas.bigp+arimas.bigd+arimas.bigq=0 .
Constraint: if arimas.s0, arimas.bigp+arimas.bigd+arimas.bigq0 .
Constraint: transfv.nag_b0 .
Constraint: transfv.nag_p0 .
Constraint: transfv.nag_q0 .
NE_INT
On entry, npar is inconsistent with transfv and arimas: npar=value.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_MODEL_PARAMS
A supplied model has invalid parameters.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_SINGULAR
The matrix used to solve for starting values for MA is singular.
NE_TIME_SERIES
The supplied time series is too short.

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
Parallelism and Performance

nag_tsa_transf_filter (g13bbc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_tsa_transf_filter (g13bbc) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the x06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9
Further Comments

If an ARIMA model is supplied, local workspace arrays of fixed lengths are allocated internally by nag_tsa_transf_filter (g13bbc). The total size of these arrays amounts to K Integer elements and K×K+2 double elements, where K=transfv.nag_p+arimas.p+arimas.d+arimas.bigp+arimas.bigd×arimas.s.
The time taken by nag_tsa_transf_filter (g13bbc) 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.

10
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 nag_tsa_multi_inp_model_forecast (g13bjc). The backforecasts are inserted at the start of the series and nag_tsa_transf_filter (g13bbc) is called to perform the filtering.

10.1
Program Text

Program Text (g13bbce.c)

10.2
Program Data

Program Data (g13bbce.d)

10.3
Program Results

Program Results (g13bbce.r)

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