g13bg accepts a series of new observations of an output time series and any associated input time series, for which a multi-input model is already fully specified, and updates the ‘state set’ information for use in constructing further forecasts.

# Syntax

C# |
---|

public static void g13bg( double[] sttf, int nsttf, int[] mr, int nser, int[,] mt, double[] para, int npara, int nnv, double[,] xxyn, int kzef, double[] res, out int ifail ) |

Visual Basic |
---|

Public Shared Sub g13bg ( _ sttf As Double(), _ nsttf As Integer, _ mr As Integer(), _ nser As Integer, _ mt As Integer(,), _ para As Double(), _ npara As Integer, _ nnv As Integer, _ xxyn As Double(,), _ kzef As Integer, _ res As Double(), _ <OutAttribute> ByRef ifail As Integer _ ) |

Visual C++ |
---|

public: static void g13bg( array<double>^ sttf, int nsttf, array<int>^ mr, int nser, array<int,2>^ mt, array<double>^ para, int npara, int nnv, array<double,2>^ xxyn, int kzef, array<double>^ res, [OutAttribute] int% ifail ) |

F# |
---|

static member g13bg : sttf : float[] * nsttf : int * mr : int[] * nser : int * mt : int[,] * para : float[] * npara : int * nnv : int * xxyn : float[,] * kzef : int * res : float[] * ifail : int byref -> unit |

#### Parameters

- sttf
- Type: array<System..::..Double>[]()[][]An array of size [nsttf]
*On entry*: the nsttf values in the state set before updating as returned by g13be or g13bj, or a previous call to g13bg.*On exit*: the state set values after updating.

- nsttf
- Type: System..::..Int32

- mr
- Type: array<System..::..Int32>[]()[][]An array of size [$7$]
*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$.

- nser
- Type: System..::..Int32
*On entry*: the total number of input and output series. There may be any number of input series (including none), but only one output series.

- mt
- Type: array<System..::..Int32,2>[,](,)[,][,]An array of size [$4$, nser]
*On entry*: the transfer function model orders $b$, $p$ and $q$ of each of the input series. The data 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 and ${r}_{i}=2\text{ or}3$ for a transfer function input. When ${r}_{i}=1$ any nonzero contents of rows 1, 2 and 3 of column $i$ are ignored. The choice of ${r}_{i}=2$ or ${r}_{i}=3$ is an option for use in model estimation and does not affect the operation of g13bg.*Constraint*: ${\mathbf{mt}}[3,\mathit{i}-1]=1$, $2$ or $3$, for $\mathit{i}=1,2,\dots ,{\mathbf{nser}}-1$.

- para
- Type: array<System..::..Double>[]()[][]An array of size [npara]
*On entry*: estimates of the multi-input model parameters as returned by g13be. 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 the transfer function model parameter values ${\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 value of the constant $c$.

- npara
- Type: System..::..Int32
*On entry*: the exact number of $\varphi $, $\theta $, $\Phi $, $\Theta $, $\omega $, $\delta $ and $c$ parameters. ($c$ must be included whether its value was previously estimated or was set fixed.)

- nnv
- Type: System..::..Int32
*On entry*: the number of new observation sets being used to update the state set, each observation set consisting of a value of the output series and the associated values of each of the input series at a particular time point.

- xxyn
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, nser]
**Note:**dim1 must satisfy the constraint: $\mathrm{dim1}\ge {\mathbf{nnv}}$*On entry*: the nnv new observation sets being used to update the state set. Column $i-1$ contains the values of input series $\mathit{i}$, for $\mathit{i}=1,2,\dots ,{\mathbf{nser}}-1$. Column ${\mathbf{nser}}-1$ contains the values of the output series. Consecutive rows correspond to increasing time sequence.

- kzef
- Type: System..::..Int32

- res
- Type: array<System..::..Double>[]()[][]An array of size [nnv]
*On exit*: the values of the residual series ${a}_{t}$ corresponding to the new observations of the output series.

- ifail
- Type: System..::..Int32%
*On exit*: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

# Description

The multi-input model is specified in [Description] in g13be. The form of these equations required to update the state set is as follows:

the transfer models which generate input component values ${z}_{i,t}$ from one or more inputs ${x}_{i,t}$,

which generates the output noise component from the output ${y}_{t}$ and the input components, and

the ARIMA model for the output noise which generates the residuals ${a}_{t}$.

$${z}_{t}={\delta}_{1}{z}_{t-1}+{\delta}_{2}{z}_{t-2}+\cdots +{\delta}_{p}{z}_{t-p}+{\omega}_{0}{x}_{t-b}-{\omega}_{1}{x}_{t-b-1}-\cdots -{\omega}_{q}{x}_{t-b-q}$$ |

$${n}_{t}={y}_{t}-{z}_{1,t}-{z}_{2,t}-\cdots -{z}_{m,t}$$ |

$$\begin{array}{ll}{w}_{t}& ={\nabla}^{d}{\nabla}_{s}^{D}{n}_{t}-c\\ {e}_{t}& ={w}_{t}-{\Phi}_{1}{w}_{t-s}-{\Phi}_{2}{w}_{t-2\times s}-\cdots -{\Phi}_{P}{w}_{t-P\times s}+{\Theta}_{1}{e}_{t-s}+{\Theta}_{2}{e}_{t-2\times s}+\cdots +{\Theta}_{Q}{e}_{t-Q\times s}\\ {a}_{t}& ={e}_{t}-{\varphi}_{1}{e}_{t-1}-{\varphi}_{2}{e}_{t-2}-\cdots -{\varphi}_{p}{e}_{t-p}+{\theta}_{1}{a}_{t-1}+{\theta}_{2}{a}_{t-2}+\cdots +{\theta}_{q}{a}_{t-q}\end{array}$$ |

The state set (as also given in [Description] in g13be) is the collection of terms

for $k=1$ up to the maximum lag associated with each of these series respectively, in the above model equations. $n$ is the latest time point of the series from which the state set has been generated.

$${z}_{n+1-k},{x}_{n+1-k},{n}_{n+1-k},{w}_{n+1-k},{e}_{n+1-k}\text{\hspace{1em} and \hspace{1em}}{a}_{n+1-k}$$ |

The method accepts further values of the series ${y}_{\mathit{t}}$, ${x}_{1,\mathit{t}},{x}_{2,\mathit{t}},\dots ,{x}_{m,\mathit{t}}$, for $\mathit{t}=n+1,\dots ,n+l$, and applies the above model equations over this time range, to generate new values of the various model components, noise series and residuals. The state set is reconstructed, corresponding to the latest time point $n+l$, the earlier values being discarded.

The set of residuals corresponding to the new observations may be of use in checking that the new observations conform to the previously fitted model. The components of the new observations of the output series which are due to the various inputs, and the noise component, are also optionally returned.

The parameters of the model are not changed in this method.

# References

Box G E P and Jenkins G M (1976)

*Time Series Analysis: Forecasting and Control*(Revised Edition) Holden–Day# Error Indicators and Warnings

Errors or warnings detected by the method:

Some error messages may refer to parameters that are dropped from this interface
(LDXXYN) In these
cases, an error in another parameter has usually caused an incorrect value to be inferred.

- ${\mathbf{ifail}}=4$
On entry, iwa is too small.

- ${\mathbf{ifail}}=5$
- On entry, one of the ${r}_{\mathit{i}}$, stored in ${\mathbf{mt}}[3,\mathit{i}-1]$, for $\mathit{i}=1,2,\dots ,{\mathbf{nser}}-1$ does not equal $1$, $2$ or $3$.

- ${\mathbf{ifail}}=-9000$
- An error occured, see message report.
- ${\mathbf{ifail}}=-6000$
- Invalid Parameters $\u2329\mathit{\text{value}}\u232a$
- ${\mathbf{ifail}}=-4000$
- Invalid dimension for array $\u2329\mathit{\text{value}}\u232a$
- ${\mathbf{ifail}}=-8000$
- Negative dimension for array $\u2329\mathit{\text{value}}\u232a$
- ${\mathbf{ifail}}=-6000$
- Invalid Parameters $\u2329\mathit{\text{value}}\u232a$

# Accuracy

The computations are believed to be stable.

# Parallelism and Performance

None.

# Further Comments

The time taken by g13bg is approximately proportional to ${\mathbf{nnv}}\times {\mathbf{npara}}$.

# Example

The following are computed and printed out: the updated state set, the residuals ${a}_{t}$ and the values of the components ${z}_{t}$ and the output noise component ${n}_{t}$ corresponding to the new observations.

Example program (C#): g13bge.cs