G13 Chapter Contents
G13 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentG13BEF

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.

## 1  Purpose

G13BEF fits a multi-input model relating one output series to the input series with a choice of three different estimation criteria: nonlinear least squares, exact likelihood and marginal likelihood. When no input series are present, G13BEF fits a univariate ARIMA model.

## 2  Specification

 SUBROUTINE G13BEF ( MR, NSER, MT, PARA, NPARA, KFC, NXXY, XXY, LDXXY, KEF, NIT, KZSP, ZSP, ITC, SD, CM, LDCM, S, D, NDF, KZEF, RES, STTF, ISTTF, NSTTF, WA, IWA, MWA, IMWA, KPRIV, IFAIL)
 INTEGER MR(7), NSER, MT(4,NSER), NPARA, KFC, NXXY, LDXXY, KEF, NIT, KZSP, ITC, LDCM, NDF, KZEF, ISTTF, NSTTF, IWA, MWA(IMWA), IMWA, KPRIV, IFAIL REAL (KIND=nag_wp) PARA(NPARA), XXY(LDXXY,NSER), ZSP(4), SD(NPARA), CM(LDCM,NPARA), S, D, RES(NXXY), STTF(ISTTF), WA(IWA)

## 3  Description

### 3.1  The Multi-input Model

The output series ${y}_{\mathit{t}}$, for $\mathit{t}=1,2,\dots ,n$, is assumed to be the sum of (unobserved) components ${z}_{i,t}$ which are due respectively to the inputs ${x}_{\mathit{i},t}$, for $\mathit{i}=1,2,\dots ,m$.
Thus ${y}_{t}={z}_{1,t}+\cdots +{z}_{m,t}+{n}_{t}$ where ${n}_{t}$ is the error, or output noise component.
A typical component ${z}_{t}$ may be either
(a) a simple regression component, ${z}_{t}=\omega {x}_{t}$ (here ${x}_{t}$ is called a simple input), or
(b) a transfer function model component which allows for the effect of lagged values of the variable, related to ${x}_{t}$ by
 $zt = δ1 zt-1 + δ2 zt-2 + ⋯ + δp zt-p + ω0 xt-b - ω1 x t-b-1 - ⋯ - ωq x t-b-q .$
The noise ${n}_{t}$ is assumed to follow a (possibly seasonal) ARIMA model, i.e., may be represented in terms of an uncorrelated series, ${a}_{t}$, by the hierarchy of equations
 (i) ${\nabla }^{d}{\nabla }_{s}^{D}{n}_{t}=c+{w}_{t}$ (ii) ${w}_{t}={\Phi }_{1}{w}_{t-s}+{\Phi }_{2}{w}_{t-2×s}+\cdots +{\Phi }_{P}{w}_{t-P×s}+{e}_{t}-{\Theta }_{1}{e}_{t-s}-{\Theta }_{2}{e}_{t-2×s}-\cdots -{\Theta }_{Q}{e}_{t-Q×s}$ (iii) ${e}_{t}={\varphi }_{1}{e}_{t-1}+{\varphi }_{2}{e}_{t-2}+\cdots +{\varphi }_{p}{e}_{t-p}+{a}_{t}-{\theta }_{1}{a}_{t-1}-{\theta }_{2}{a}_{t-2}-\cdots -{\theta }_{q}{a}_{t-q}$
as outlined in Section 3 in G13AEF.
Note:  the orders $p,q$ appearing in each of the transfer function models and the ARIMA model are not necessarily the same; ${\nabla }^{d}{\nabla }_{s}^{D}{n}_{t}$ is the result of applying non-seasonal differencing of order $d$ and seasonal differencing of seasonality $s$ and order $D$ to the series ${n}_{t}$: the differenced series is then of length $N=n-d-s×D$; the constant term parameter $c$ may optionally be held fixed at its initial value (usually, but not necessarily zero) rather than being estimated.
For the purpose of defining an estimation criterion it is assumed that the series ${a}_{t}$ is a sequence of independent Normal variates having mean $0$ and variance ${\sigma }_{a}^{2}$. An allowance has to be made for the effects of unobserved data prior to the observation period. For the noise component an allowance is always made using a form of backforecasting.
For each transfer function input, you have to decide what values are to be assumed for the pre-period terms ${z}_{0},{z}_{-1},\dots ,{z}_{1-p}$ and ${x}_{0},{x}_{-1},\dots ,{x}_{1-b-q}$ which are in theory necessary to re-create the component series ${z}_{1},{z}_{2},\dots ,{z}_{n}$, during the estimation procedure.
The first choice is to assume that all these values are zero. In this case, in order to avoid undesirable transient distortion of the early values ${z}_{1},{z}_{2},\dots \text{}$, you are advised first to correct the input series ${x}_{t}$ by subtracting from all the terms a suitable constant to make the early values ${x}_{1},{x}_{2},\dots \text{}$, close to zero. The series mean $\stackrel{-}{x}$ is one possibility, but for a series with strong trend the constant might be simply ${x}_{1}$.
The second choice is to treat the unknown pre-period terms as nuisance parameters and estimate them along with the other parameters. This choice should be used with caution. For example, if $p=1$ and $b=q=0$, it is equivalent to fitting to the data a decaying geometric curve of the form $A{\delta }^{\mathit{t}}$, for $\mathit{t}=1,2,\dots$, along with the other inputs, this being the form of the transient. If the output ${y}_{t}$ contains a strong trend of this form, which is not otherwise represented in the model, it will have a tendency to influence the estimate of $\delta$ away from the value appropriate to the transfer function model.
In most applications the first choice should be adequate, with the option possibly being used as a refinement at the end of the modelling process. The number of nuisance parameters is then $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(p,b+q\right)$, with a corresponding loss of degrees of freedom in the residuals. If you align the input ${x}_{t}$ with the output by using in its place the shifted series ${x}_{t-b}$, then setting $b=0$ in the transfer function model, there is some improvement in efficiency. On some occasions when the model contains two or more inputs, each with estimation of pre-period nuisance parameters, these parameters may be co-linear and lead to failure of the routine. The option must then be ‘switched off’ for one or more inputs.

### 3.2  The Estimation Criterion

This is a measure of how well a proposed set of parameters in the transfer function and noise ARIMA models matches the data. The estimation routine searches for parameter values which minimize this criterion. For a proposed set of parameter values it is derived by calculating
(i) the components ${z}_{1,t},{z}_{2,t},\dots ,{z}_{m,t}$ as the responses to the input series ${x}_{1,t},{x}_{2,t}\dots ,{x}_{m,t}$ using the equations (a) or (b) above,
(ii) the discrepancy between the output and the sum of these components, as the noise
 $n t = y t - z 1 , t + z 2 , t + ⋯ + z m , t ,$
(iii) the residual series ${a}_{t}$ from ${n}_{t}$ by reversing the recursive equations (i), (ii) and (iii) above.
This last step again requires treatment of the effect of unknown pre-period values of ${n}_{t}$ and other terms in the equations regenerating ${a}_{t}$. This is identical to the treatment given in Section 3 in G13AEF, and leads to a criterion which is a sum of squares function $S$, of the residuals ${a}_{t}$. It may be shown that the finite algorithm presented there is equivalent to taking the infinite set of past values ${n}_{0},{n}_{-1},{n}_{-2},\dots$, as (linear) nuisance parameters. The pre-period nuisance parameters for the input series are included in the reduction of $\mathit{df}$, as is the constant if it is estimated.
The covariance matrix of the vector of model parameter estimates is given by
 $erv×H-1$
where $H$ is the linearized least squares matrix taken from the final iteration of the algorithm of Marquardt. From this expression are derived the vector of standard deviations, and the correlation matrix of parameter estimates. These are approximations which are only valid asymptotically, and must be treated with great caution when the parameter estimates are close to their constraint boundaries.
The residual series ${a}_{t}$ is available upon completion of the iterations over the range $t=1+d+s×D,\dots ,n$ corresponding to the differenced noise series ${w}_{t}$.
Because of the algorithm used for backforecasting, these are only true residuals for $t\ge 1+q+s×Q-p-s×P-d-s×D$, provided this is positive. Estimation of pre-period terms for the inputs will also tend to reduce the magnitude of the early residuals, sometimes severely.
The model component series ${z}_{1,t},\dots ,{z}_{m,t}$ and ${n}_{t}$ may optionally be returned in place of the supplied series values, in order to assess the effects of the various inputs on the output.

### 3.3  Forecasting Information

For the purpose of constructing forecasts of the output series at future time points $t=n+1,n+2,\dots \text{}$ using G13BHF, it is not necessary to use the whole set of observations ${y}_{t}$ and ${x}_{1,\mathit{t}},{x}_{2,\mathit{t}},\dots ,{x}_{m,\mathit{t}}$, for $\mathit{t}=1,2,\dots ,m$. It is sufficient to retain a limited set of quantities constituting the ‘state set’ as follows: for each series which appears with lagged subscripts in equations (a), (b), (i), (ii) and (iii) above, include the values at times $n+1-k$ for $k=1$ up to the maximum lag associated with that series in the equations. Note that (i) implicitly includes past values of ${n}_{t}$ and intermediate differences of ${n}_{t}$ such as ${\nabla }^{d-1}{\nabla }_{s}^{D}$.
If later observations of the series become available, it is possible to update the state set (without re-estimating the model) using G13BGF. If time series data is supplied with a previously estimated model, it is possible to construct the state set (and forecasts) using G13BJF.
Box G E P and Jenkins G M (1976) Time Series Analysis: Forecasting and Control (Revised Edition) Holden–Day
Marquardt D W (1963) An algorithm for least-squares estimation of nonlinear parameters J. Soc. Indust. Appl. Math. 11 431

## 5  Parameters

1:     MR($7$) – INTEGER arrayInput
On entry: the orders vector $\left(p,d,q,P,D,Q,s\right)$ of the ARIMA model for the output noise component.
$p$, $q$, $P$ and $Q$ refer respectively to the number of autoregressive $\left(\varphi \right)$, moving average $\left(\theta \right)$, seasonal autoregressive $\left(\Phi \right)$ and seasonal moving average $\left(\Theta \right)$ parameters.
$d$, $D$ and $s$ refer respectively to the order of non-seasonal differencing, the order of seasonal differencing and the seasonal period.
Constraints:
• $p$, $d$, $q$, $P$, $D$, $Q$, $s\ge 0$;
• $p+q+P+Q>0$;
• $s\ne 1$;
• if $s=0$, $P+D+Q=0$;
• if $s>1$, $P+D+Q>0$;
• $d+s×\left(P+D\right)\le n$;
• $p+d-q+s×\left(P+D-Q\right)\le n$.
2:     NSER – INTEGERInput
On entry: the total number of input and output series. There may be any number of input series (including none), but always one output series.
Constraints:
• ${\mathbf{NSER}}\ge 1$;
• if there are no parameters in the model (that is, $p=q=P=Q=0$ and ${\mathbf{KFC}}=0$), ${\mathbf{NSER}}>1$.
3:     MT($4$,NSER) – INTEGER arrayInput
On entry: the transfer function model orders $b$, $p$ and $q$ of each of the input series. The order parameters for input series $i$ are held in column $i$. Row $1$ holds the value ${b}_{i}$, row 2 holds the value ${q}_{i}$ and row 3 holds the value ${p}_{i}$. For a simple input, ${b}_{i}={q}_{i}={p}_{i}=0$.
Row 4 holds the value ${r}_{i}$, where ${r}_{i}=1$ for a simple input, ${r}_{i}=2$ for a transfer function input for which no allowance is to be made for pre-observation period effects, and ${r}_{i}=3$ for a transfer function input for which pre-observation period effects will be treated by estimation of appropriate nuisance parameters.
When ${r}_{i}=1$, any nonzero contents of rows 1, 2, and 3 of column $i$ are ignored.
Constraint: ${\mathbf{MT}}\left(4,\mathit{i}\right)=1\text{, ​}2\text{​ or ​}3$, for $\mathit{i}=1,2,\dots ,{\mathbf{NSER}}-1$.
4:     PARA(NPARA) – REAL (KIND=nag_wp) arrayInput/Output
On entry: initial values of the multi-input model parameters. These are in order, firstly the ARIMA model parameters: $p$ values of $\varphi$ parameters, $q$ values of $\theta$ parameters, $P$ values of $\Phi$ parameters and $Q$ values of $\Theta$ parameters. These are followed by initial values of the transfer function model parameters ${\omega }_{0},{\omega }_{1},\dots ,{\omega }_{{q}_{1}}$, ${\delta }_{1},{\delta }_{2},\dots ,{\delta }_{{p}_{1}}$ for the first of any input series and similarly for each subsequent input series. The final component of PARA is the initial value of the constant $c$, whether it is fixed or is to be estimated.
On exit: the latest values of the estimates of these parameters.
5:     NPARA – INTEGERInput
On entry: the exact number of $\varphi ,\theta ,\Phi ,\Theta$, $\omega ,\delta$ and $c$ parameters.
Constraint: ${\mathbf{NPARA}}=p+q+P+Q+{\mathbf{NSER}}+\sum \left({p}_{i}+{q}_{i}\right)$, the summation being over all the ${p}_{i}\ne {q}_{i}$ supplied in MT. $c$ must be included, whether fixed or estimated.
6:     KFC – INTEGERInput
On entry: must be set to $0$ if the constant $c$ is to remain fixed at its initial value, and $1$ if it is to be estimated.
Constraint: ${\mathbf{KFC}}=0$ or $1$.
7:     NXXY – INTEGERInput
On entry: the (common) length of the original, undifferenced input and output time series.
8:     XXY(LDXXY,NSER) – REAL (KIND=nag_wp) arrayInput/Output
On entry: the columns of XXY must contain the NXXY original, undifferenced values of each of the input series and the output series ${x}_{t}$ in that order.
On exit: if ${\mathbf{KZEF}}=0$, XXY remains unchanged on exit.
If ${\mathbf{KZEF}}\ne 0$, the columns of XXY hold the corresponding values of the input component series ${z}_{t}$ in place of ${x}_{t}$ and the output noise component ${n}_{t}$ in place of ${y}_{t}$, in that order.
9:     LDXXY – INTEGERInput
On entry: the first dimension of the array XXY as declared in the (sub)program from which G13BEF is called.
Constraint: ${\mathbf{LDXXY}}\ge {\mathbf{NXXY}}$.
10:   KEF – INTEGERInput
On entry: indicates the likelihood option.
${\mathbf{KEF}}=1$
Gives least squares.
${\mathbf{KEF}}=2$
Gives exact likelihood.
${\mathbf{KEF}}=3$
Gives marginal likelihood.
Constraint: ${\mathbf{KEF}}=1$, $2$ or $3$.
11:   NIT – INTEGERInput
On entry: the maximum required number of iterations.
${\mathbf{NIT}}=0$
No change is made to any of the model parameters in array PARA except that the constant $c$ (if ${\mathbf{KFC}}=1$) and any $\omega$ relating to simple input series are estimated. (Apart from these, estimates are always derived for the nuisance parameters relating to any backforecasts and any pre-observation period effects for transfer function inputs.)
Constraint: ${\mathbf{NIT}}\ge 0$.
12:   KZSP – INTEGERInput
On entry: must be set to $1$ if the routine is to use the input values of ZSP in the minimization procedure, and to any other value if the default values of ZSP are to be used.
13:   ZSP($4$) – REAL (KIND=nag_wp) arrayInput/Output
On entry: if ${\mathbf{KZSP}}=1$, then ZSP must contain the four values used to control the strategy of the search procedure.
${\mathbf{ZSP}}\left(1\right)$
Contains $\alpha$, the value used to constrain the magnitude of the search procedure steps.
${\mathbf{ZSP}}\left(2\right)$
Contains $\beta$, the multiplier which regulates the value of $\alpha$.
${\mathbf{ZSP}}\left(3\right)$
Contains $\delta$, the value of the stationarity and invertibility test tolerance factor.
${\mathbf{ZSP}}\left(4\right)$
Contains $\gamma$, the value of the convergence criterion.
If ${\mathbf{KZSP}}\ne 1$ before entry, default values of ZSP are supplied by the routine. These are $0.01$, $10.0$, $1000.0$ and , respectively.
On exit: contains the values, default or otherwise, used by the routine.
Constraint: if ${\mathbf{KZSP}}=1$, ${\mathbf{ZSP}}\left(1\right)>0.0$, ${\mathbf{ZSP}}\left(2\right)>1.0$, ${\mathbf{ZSP}}\left(3\right)\ge 1.0$, $0\le {\mathbf{ZSP}}\left(4\right)<1.0$.
14:   ITC – INTEGEROutput
On exit: the number of iterations carried out.
${\mathbf{ITC}}=-1$
Indicates that the only estimates obtained up to this point have been for the nuisance parameters relating to backforecasts, unless the marginal likelihood option is used, in which case estimates have also been obtained for simple input coefficients $\omega$ and for the constant $c$ (if ${\mathbf{KFC}}=1$). This value of ITC usually indicates a failure in a consequent step of estimating transfer function input pre-observation period nuisance parameters.
${\mathbf{ITC}}=0$
Indicates that estimates have been obtained up to this point for the constant $c$ (if ${\mathbf{KFC}}=1$), for simple input coefficients $\omega$ and for the nuisance parameters relating to the backforecasts and to transfer function input pre-observation period effects.
15:   SD(NPARA) – REAL (KIND=nag_wp) arrayOutput
On exit: the NPARA values of the standard deviations corresponding to each of the parameters in PARA. When the constant is fixed its standard deviation is returned as zero. When the values of PARA are valid, the values of SD are usually also valid. However, if an exit value of ${\mathbf{IFAIL}}={\mathbf{3}}$, ${\mathbf{8}}$ or ${\mathbf{10}}$, then the contents of SD will be indeterminate.
16:   CM(LDCM,NPARA) – REAL (KIND=nag_wp) arrayOutput
On exit: the first NPARA rows and columns of CM contain the correlation coefficients relating to each pair of parameters in PARA. All coefficients relating to the constant will be zero if the constant is fixed. The contents of CM will be indeterminate under the same conditions as SD.
17:   LDCM – INTEGERInput
On entry: the first dimension of the array CM as declared in the (sub)program from which G13BEF is called.
Constraint: ${\mathbf{LDCM}}\ge {\mathbf{NPARA}}$.
18:   S – REAL (KIND=nag_wp)Output
On exit: the residual sum of squares, $S$, at the latest set of valid parameter estimates.
19:   D – REAL (KIND=nag_wp)Output
On exit: the objective function, $D$, at the latest set of valid parameter estimates.
20:   NDF – INTEGEROutput
On exit: the number of degrees of freedom associated with $S$.
21:   KZEF – INTEGERInput
On entry: must not be set to $0$, if the values of the input component series ${z}_{t}$ and the values of the output noise component ${n}_{t}$ are to overwrite the contents of XXY on exit, and must be set to $0$ if XXY is to remain unchanged.
22:   RES(NXXY) – REAL (KIND=nag_wp) arrayOutput
On exit: the values of the residuals relating to the differenced values of the output series. The remainder of the first NXXY terms in the array will be zero.
23:   STTF(ISTTF) – REAL (KIND=nag_wp) arrayOutput
On exit: the NSTTF values of the state set array.
24:   ISTTF – INTEGERInput
On entry: the dimension of the array STTF as declared in the (sub)program from which G13BEF is called.
Constraint: ${\mathbf{ISTTF}}\ge \left(P×s\right)+d+\left(D×s\right)+q+\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(p,Q×s\right)+\mathit{ncg}$, where $\mathit{ncg}=\sum \left({b}_{i}+{q}_{i}+{p}_{i}\right)$ over all input series for which ${r}_{i}>1$.
25:   NSTTF – INTEGEROutput
On exit: the number of values in the state set array STTF.
26:   WA(IWA) – REAL (KIND=nag_wp) arrayWorkspace
27:   IWA – INTEGERInput
On entry: the dimension of the array WA as declared in the (sub)program from which G13BEF is called.
It is not practical to outline a method for deriving the exact minimum permissible value of IWA, but the following gives a reasonably good conservative approximation. (It should be noted that if IWA is too small (but not grossly so) then the exact minimum is returned in ${\mathbf{MWA}}\left(i\right)$ and is also printed if ${\mathbf{KPRIV}}\ne 0$.)
Let ${q}^{\prime }=q+\left(Q×s\right)$ and ${d}^{\prime }=d+\left(D×s\right)$ where the orders of the output noise model are $p$, $d$, $q$, $P$, $D$, $Q$, $s$.
Let there be $l$ input series, where $l={\mathbf{NSER}}-1$.
Let
 $mxi = max bi + qi ,pi , if ​ ri=3 , for ​ i=1,2…,l mxi = 0 , if ​ ri≠3 , for ​ i=1,2…,l$
where the transfer function model orders for input $i$ are given by ${b}_{i}$, ${q}_{i}$, ${p}_{i}$, ${r}_{i}$.
Let $qx=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({q}^{\prime },m{x}_{1},m{x}_{2},\dots ,m{x}_{l}\right)$.
Let $\mathit{ncd}={\mathbf{NPARA}}+{\mathbf{KFC}}+qx+\sum _{i=1}^{l}m{x}_{i}$ and $\mathit{nce}={\mathbf{NXXY}}+{d}^{\prime }+6×qx$.
Finally, let $\mathit{ncf}={\mathbf{NSER}}$, and then increment $\mathit{ncf}$ by $1$ every time any of the following conditions is satisfied. (The last six conditions should be applied separately to each input series, so that, for example, if we have two input series and if ${p}_{1}>0$ and ${p}_{2}>0$ then $\mathit{ncf}$ is incremented by $2$.)
The conditions are:
Then ${\mathbf{IWA}}\ge 2×{\left(\mathit{ncd}\right)}^{2}+\left(\mathit{nce}\right)×\left(\mathit{ncf}+4\right)$.
28:   MWA(IMWA) – INTEGER arrayWorkspace
29:   IMWA – INTEGERInput
On entry: the dimension of the array MWA as declared in the (sub)program from which G13BEF is called.
Constraint: ${\mathbf{IMWA}}\ge \left(16×{\mathbf{NSER}}\right)+\left(7×\mathit{ncd}\right)+\left(3×{\mathbf{NPARA}}\right)+\left(3×{\mathbf{KFC}}\right)+27$, where the derivation of $\mathit{ncd}$ is shown under IWA.
If IMWA is too small then the exact minimum needed is returned in IMWA and if ${\mathbf{KPRIV}}\ne 0$ it is also printed.
30:   KPRIV – INTEGERInput
On entry: must not be set to $0$, if it is required to monitor the course of the optimization or to print out the requisite minimum values of IWA or IMWA in the event of an error of the type ${\mathbf{IFAIL}}={\mathbf{6}}$ or ${\mathbf{7}}$. The course of the optimization is monitored by printing out at each iteration the iteration count (ITC), the residual sum of squares (S), the objective function (D) and a description and value for each of the parameters in the PARA array. The descriptions are PHI for $\varphi$, THETA for $\theta$, SPHI for $\Phi$, STHETA for $\Theta$, OMEGA/SI for $\omega$ in a simple input, OMEGA for $\omega$ in a transfer function input, DELTA for $\delta$ and CONSTANT for $c$. In addition SERIES 1, SERIES 2, etc. indicate the input series relevant to the OMEGA and DELTA parameters.
KPRIV must be set to $0$ if the print-out of the above information is not required.
31:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ 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\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if ${\mathbf{IFAIL}}\ne {\mathbf{0}}$ on exit, the recommended value is $-1$. When the value $-\mathbf{1}\text{​ or ​}1$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Note: G13BEF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=1$
 On entry, ${\mathbf{KFC}}<0$, or ${\mathbf{KFC}}>1$, or ${\mathbf{LDXXY}}<{\mathbf{NXXY}}$, or ${\mathbf{LDCM}}<{\mathbf{NPARA}}$, or ${\mathbf{KEF}}<1$, or ${\mathbf{KEF}}>3$, or ${\mathbf{NIT}}<0$, or ${\mathbf{NSER}}<1$, or ${\mathbf{NSER}}=1$ and there are no parameters in the model ($p=q=P=Q=0$ and ${\mathbf{KFC}}=0$).
${\mathbf{IFAIL}}=2$
On entry, there is inconsistency between NPARA and KFC on the one hand and the orders in arrays MR and MT on the other, or one of the ${r}_{i}$, stored in ${\mathbf{MT}}\left(4,i\right)\ne 1$, $2$ or $3$.
${\mathbf{IFAIL}}=3$
On entry or during execution, one or more sets of $\delta$ parameters do not satisfy the stationarity or invertibility test conditions.
${\mathbf{IFAIL}}=4$
 On entry, when ${\mathbf{KZSP}}=1$, ${\mathbf{ZSP}}\left(1\right)\le 0.0$, or ${\mathbf{ZSP}}\left(2\right)\le 1.0$, or ${\mathbf{ZSP}}\left(3\right)<1.0$, or ${\mathbf{ZSP}}\left(4\right)<0.0$, or ${\mathbf{ZSP}}\left(4\right)\ge 1.0$.
${\mathbf{IFAIL}}=5$
On entry, IWA is too small by a considerable margin. No information is supplied about the requisite minimum size.
${\mathbf{IFAIL}}=6$
On entry, IWA is too small, but the requisite minimum size is returned in ${\mathbf{MWA}}\left(1\right)$, which is printed if ${\mathbf{KPRIV}}\ne 0$.
${\mathbf{IFAIL}}=7$
On entry, IMWA is too small, but the requisite minimum size is returned in ${\mathbf{MWA}}\left(1\right)$, which is printed if ${\mathbf{KPRIV}}\ne 0$.
${\mathbf{IFAIL}}=8$
This indicates a failure in F04ASF which is used to solve the equations giving the latest estimates of the parameters.
${\mathbf{IFAIL}}=9$
This indicates a failure in the inversion of the second derivative matrix. This is needed in the calculation of the correlation matrix and the standard deviations of the parameter estimates.
${\mathbf{IFAIL}}=10$
On entry or during execution, one or more sets of the ARIMA ($\varphi$, $\theta$, $\Phi$ or $\Theta$) parameters do not satisfy the stationarity or invertibility test conditions.
${\mathbf{IFAIL}}=11$
On entry, ISTTF is too small. The state set information will not be produced and if ${\mathbf{KZEF}}\ne 0$ array XXY will remain unchanged. All other parameters will be produced correctly.
${\mathbf{IFAIL}}=12$
The routine has failed to converge after NIT iterations. If steady decreases in the objective function, $D$, were monitored up to the point where this exit occurred, then the exit probably occurred because NIT was set too small, so the calculations should be restarted from the final point held in PARA.
${\mathbf{IFAIL}}=13$
On entry, ISTTF is too small (see ${\mathbf{IFAIL}}={\mathbf{11}}$) and NIT iterations were carried out without the convergence conditions being satisfied (see ${\mathbf{IFAIL}}={\mathbf{12}}$).

## 7  Accuracy

The computation used is believed to be stable.

The time taken by G13BEF is approximately proportional to ${\mathbf{NXXY}}×{\mathbf{ITC}}×{{\mathbf{NPARA}}}^{2}$.

## 9  Example

After the full $11$ iterations, the following are computed and printed out: the final values of the PARA parameters and their standard errors, the correlation matrix, the residuals for the $36$ differenced values, the values of ${z}_{t}$ and ${n}_{t}$, the values of the state set and the number of degrees of freedom.

### 9.1  Program Text

Program Text (g13befe.f90)

### 9.2  Program Data

Program Data (g13befe.d)

### 9.3  Program Results

Program Results (g13befe.r)