NAG Library Function Document

nag_tsa_transf_prelim_fit (g13bdc)


    1  Purpose
    7  Accuracy


nag_tsa_transf_prelim_fit (g13bdc) calculates preliminary estimates of the parameters of a transfer function model.


#include <nag.h>
#include <nagg13.h>
void  nag_tsa_transf_prelim_fit (double r0, const double r[], Integer nl, Nag_TransfOrder *transfv, double s, double wds[], Integer isf[], NagError *fail)


nag_tsa_transf_prelim_fit (g13bdc) calculates estimates of parameters δ1,δ2,,δp, ω0,ω1,,ωq in the transfer function model
given cross-correlations between the series xt and lagged values of yt:
rxyl,  l=0,1,,L  
and the ratio of standard deviations sy/sx, as supplied by nag_tsa_cross_corr (g13bcc).
It is assumed that the series xt used to calculate the cross-correlations is a sample from a time series with true autocorrelations of zero. Otherwise the cross-correlations between the series bt and at, as defined in the description of nag_tsa_arma_filter (g13bac), should be used in place of those between yt and xt.
The estimates are obtained by solving for δ1,δ2,,δp the equations
rxyb+q+j=δ1rxyb+q+j-1++δprxyb+q+j-p,  j=1,2,,p  
then calculating
ωi = ± sy / sx rxy b+i - δ1 rxy b+i- 1 - - δp rxy b+i-p ,   i= 0,1,,q  
where the ‘+’ is used for ω0 and ‘-’ for ωi, i>0.
Any value of rxyl arising in these equations for l<b is taken as zero. The parameters δ1,δ2,,δp are checked as to whether they satisfy the stability criterion.


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


1:     r0 doubleInput
On entry: the cross-correlation between the two series at lag 0, rxy0.
Constraint: -1.0r01.0.
2:     r[nl] const doubleInput
On entry: the cross-correlations between the two series at lags 1 to L, rxyl, for l=1,2,,L.
Constraint: -1.0r[i]1.0, for i=0,1,,nl-1.
3:     nl IntegerInput
On entry: L, the number of lagged cross-correlations in the array r.
Constraint: nlmax transfv.nag_b+transfv.nag_q+transfv.nag_p,1.
4:     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.
  • transfv.nag_b0 ;
  • transfv.nag_q0 ;
  • transfv.nag_p0 .
5:     s doubleInput
On entry: the ratio of the standard deviation of the y series to that of the x series, sy/sx.
Constraint: s>0.0.
6:     wds[dim] doubleOutput
Note: the dimension, dim, of the array wds must be at least transfv.nag_q+transfv.nag_p+1.
On exit: the preliminary estimates of the parameters of the transfer function model in the order of q+1 MA-like parameters followed by the p AR-like parameters. If the estimation of either type of parameter fails then these arguments are set to 0.0.
7:     isf[2] IntegerOutput
On exit: indicators of the success of the estimation of MA-like and AR-like parameters respectively. A value 0 indicates that there are no parameters of that type to be estimated. A value of 1 or -1 indicates that there are parameters of that type in the model and the estimation of that type has been successful or unsuccessful respectively. Note that there is always at least one MA-like parameter in the model.
8:     fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

Error Indicators and Warnings

Dynamic memory allocation failed.
See Section in How to Use the NAG Library and its Documentation for further information.
On entry, argument value had an illegal value.
Constraint: transfv.nag_b0 .
Constraint: transfv.nag_p0 .
Constraint: transfv.nag_q0 .
On entry, nl=value, transfv.nag_b=value, transfv.nag_q=value and transfv.nag_p=value.
Constraint: nlmaxtransfv.nag_b+transfv.nag_q+transfv.nag_p,1.
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.
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.
On entry, r0 lies outside -1.0,1.0: r0=value.
On entry, s=value.
Constraint: s>0.0.
On entry, r[I-1] lies outside -1.0,1.0: I=value and r[I-1]=value.


Equations used in the computations may become unstable, in which case results are reset to zero with array isf values set accordingly.

Parallelism and Performance

nag_tsa_transf_prelim_fit (g13bdc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_tsa_transf_prelim_fit (g13bdc) 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.

Further Comments

The time taken by nag_tsa_transf_prelim_fit (g13bdc) is roughly proportional to transfv.nag_q+transfv.nag_p+13.


This example reads the cross-correlations between two series at lags 0 to 6. It then reads a 3,2,1 transfer function model and calculates and prints the preliminary estimates of the parameters of the model.

Program Text

Program Text (g13bdce.c)

Program Data

Program Data (g13bdce.d)

Program Results

Program Results (g13bdce.r)

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