Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_tsa_multi_transf_prelim (g13bd)

## Purpose

nag_tsa_multi_transf_prelim (g13bd) calculates preliminary estimates of the parameters of a transfer function model.

## Syntax

[wds, isf, ifail] = g13bd(r0, r, nna, s, 'nl', nl)
[wds, isf, ifail] = nag_tsa_multi_transf_prelim(r0, r, nna, s, 'nl', nl)

## Description

nag_tsa_multi_transf_prelim (g13bd) calculates estimates of parameters ${\delta }_{1},{\delta }_{2},\dots ,{\delta }_{p}$, ${\omega }_{0},{\omega }_{1},\dots ,{\omega }_{q}$ in the transfer function model
 $yt=δ1yt-1+δ2yt-2+⋯+δpyt-p+ω0xt-b-ω1xt-b-1-⋯-ωqxt-b-q$
given cross-correlations between the series ${x}_{t}$ and lagged values of ${y}_{t}$:
 $rxyl, l=0,1,…,L$
and the ratio of standard deviations ${s}_{y}/{s}_{x}$, as supplied by nag_tsa_multi_xcorr (g13bc).
It is assumed that the series ${x}_{t}$ 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 ${b}_{t}$ and ${a}_{t}$, as defined in the description of nag_tsa_multi_filter_arima (g13ba), should be used in place of those between ${y}_{t}$ and ${x}_{t}$.
The estimates are obtained by solving for ${\delta }_{1},{\delta }_{2},\dots ,{\delta }_{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 ${\omega }_{0}$ and ‘$-$’ for ${\omega }_{i}$, $i>0$.
Any value of ${r}_{xy}\left(l\right)$ arising in these equations for $l is taken as zero. The parameters ${\delta }_{1},{\delta }_{2},\dots ,{\delta }_{p}$ are checked as to whether they satisfy the stability criterion.

## References

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

## Parameters

### Compulsory Input Parameters

1:     $\mathrm{r0}$ – double scalar
The cross-correlation between the two series at lag $0$, ${r}_{xy}\left(0\right)$.
Constraint: $-1.0\le {\mathbf{r0}}\le 1.0$.
2:     $\mathrm{r}\left({\mathbf{nl}}\right)$ – double array
The cross-correlations between the two series at lags $1$ to $L$, ${r}_{xy}\left(\mathit{l}\right)$, for $\mathit{l}=1,2,\dots ,L$.
Constraint: $-1.0\le {\mathbf{r}}\left(\mathit{i}\right)\le 1.0$, for $\mathit{i}=1,2,\dots ,{\mathbf{nl}}$.
3:     $\mathrm{nna}\left(3\right)$int64int32nag_int array
The transfer function model orders in the standard form $b,q,p$ (i.e., delay time, number of moving-average MA-like followed by number of autoregressive AR-like parameters).
Constraint: ${\mathbf{nna}}\left(\mathit{i}\right)\ge 0$, for $\mathit{i}=1,2,3$.
4:     $\mathrm{s}$ – double scalar
The ratio of the standard deviation of the $y$ series to that of the $x$ series, ${s}_{y}/{s}_{x}$.
Constraint: ${\mathbf{s}}>0.0$.

### Optional Input Parameters

1:     $\mathrm{nl}$int64int32nag_int scalar
Default: the dimension of the array r.
$L$, the number of lagged cross-correlations in the array r.
Constraint: ${\mathbf{nl}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{nna}}\left(1\right)+{\mathbf{nna}}\left(2\right)+{\mathbf{nna}}\left(3\right),1\right)$.

### Output Parameters

1:     $\mathrm{wds}\left(\mathit{nwds}\right)$ – double array
$\mathit{nwds}={\mathbf{nna}}\left(2\right)+{\mathbf{nna}}\left(3\right)+1$.
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$.
2:     $\mathrm{isf}\left(2\right)$int64int32nag_int array
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.
3:     $\mathrm{ifail}$int64int32nag_int scalar
${\mathbf{ifail}}={\mathbf{0}}$ unless the function detects an error (see Error Indicators and Warnings).

## Error Indicators and Warnings

Errors or warnings detected by the function:
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{nna}}\left(\mathit{i}\right)<0$, for $\mathit{i}=1,2,3$, or ${\mathbf{nl}}<\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{nna}}\left(1\right)+{\mathbf{nna}}\left(2\right)+{\mathbf{nna}}\left(3\right),1\right)$, or ${\mathbf{r0}}<-1.0$ or ${\mathbf{r0}}>1.0$, or ${\mathbf{r}}\left(i\right)<-1.0$ or ${\mathbf{r}}\left(i\right)>1.0$, for some $i=1,2,\dots ,{\mathbf{nl}}$, or ${\mathbf{s}}\le 0.0$, or $\mathit{nwds}\ne {\mathbf{nna}}\left(2\right)+{\mathbf{nna}}\left(3\right)+1$, or $\mathit{iwa}<{\mathbf{nna}}\left(3\right)×\left({\mathbf{nna}}\left(3\right)+1\right)$.
${\mathbf{ifail}}=-99$
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.

## Accuracy

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

If ${\mathbf{nna}}\left(3\right)>0$,a local workspace array of fixed length is allocated internally by nag_tsa_multi_transf_prelim (g13bd). The total size of this array amounts to ${\mathbf{nna}}\left(3\right)$ integer elements and ${\mathbf{nna}}\left(3\right)×\left({\mathbf{nna}}\left(3\right)+1\right)$ double elements.
The time taken by nag_tsa_multi_transf_prelim (g13bd) is roughly proportional to ${\mathit{nwds}}^{3}$.

## Example

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

fprintf('g13bd example results\n\n');

% Cross-correlation at lag 0
r0  = -0.0155;
% Other cross-correlations
r   = [0.0339; -0.0374; -0.2895; -0.3430; -0.4518; -0.2787];

% transfer function model orders
nna = [int64(3);2;1];

%Standard deviation ratio
s   = 1.9256;

% Calculate parameter estimates
[wds, isf, ifail] = g13bd( ...
r0, r, nna, s);

% Display results
fprintf('Success/failure indicator       = %4d%4d\n\n', isf(1:2));
fprintf('Transfer function model B, Q, P = %4d%4d%4d\n\n', nna(1:3));
disp('Parameter initial estimates');
disp(wds');

```
```g13bd example results

Success/failure indicator       =    1   1

Transfer function model B, Q, P =    3   2   1

Parameter initial estimates
-0.5575    0.3166    0.4626    0.6169

```