g13dk accepts a sequence of new observations in a multivariate time series and updates both the forecasts and the standard deviations of the forecast errors. A call to g13dj must be made prior to calling this method in order to calculate the elements of a reference vector together with a set of forecasts and their standard errors. On a successful exit from g13dk the reference vector is updated so that should future series values become available these forecasts may be updated by recalling g13dk.

# Syntax

C#
public static void g13dk(
int k,
int lmax,
int m,
ref int mlast,
double[,] z,
double[] dnref,
double[,] v,
double[,] predz,
double[,] sefz,
out int ifail
)
Visual Basic
Public Shared Sub g13dk ( _
k As Integer, _
lmax As Integer, _
m As Integer, _
ByRef mlast As Integer, _
z As Double(,), _
dnref As Double(), _
v As Double(,), _
predz As Double(,), _
sefz As Double(,), _
<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g13dk(
int k,
int lmax,
int m,
int% mlast,
array<double,2>^ z,
array<double>^ dnref,
array<double,2>^ v,
array<double,2>^ predz,
array<double,2>^ sefz,
[OutAttribute] int% ifail
)
F#
static member g13dk :
k : int *
lmax : int *
m : int *
mlast : int byref *
z : float[,] *
dnref : float[] *
v : float[,] *
predz : float[,] *
sefz : float[,] *
ifail : int byref -> unit

#### Parameters

k
Type: System..::..Int32
On entry: $k$, the dimension of the multivariate time series.
Constraint: ${\mathbf{k}}\ge 1$.
lmax
Type: System..::..Int32
On entry: the number, ${l}_{\mathrm{max}}$, of forecasts requested in the call to g13dj.
Constraint: ${\mathbf{lmax}}\ge 2$.
m
Type: System..::..Int32
On entry: $m$, the number of new observations available since the last call to either g13dj or g13dk. The number of new observations since the last call to g13dj is then ${\mathbf{m}}+{\mathbf{mlast}}$.
Constraint: $0<{\mathbf{m}}<{\mathbf{lmax}}-{\mathbf{mlast}}$.
mlast
Type: System..::..Int32%
On entry: on the first call to g13dk, since calling g13dj, mlast must be set to $0$ to indicate that no new observations have yet been used to update the forecasts; on subsequent calls mlast must contain the value of mlast as output on the previous call to g13dk.
On exit: is incremented by $m$ to indicate that ${\mathbf{mlast}}+{\mathbf{m}}$ observations have now been used to update the forecasts since the last call to g13dj.
mlast must not be changed between calls to g13dk, unless a call to g13dj has been made between the calls in which case mlast should be reset to $0$.
Constraint: $0\le {\mathbf{mlast}}<{\mathbf{lmax}}-{\mathbf{m}}$.
z
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, m]
Note: dim1 must satisfy the constraint: $\mathrm{dim1}\ge {\mathbf{k}}$
On entry: ${\mathbf{z}}\left[\mathit{i}-1,\mathit{j}-1\right]$ must contain the value of ${z}_{\mathit{i},n+{\mathbf{mlast}}+\mathit{j}}$, for $\mathit{i}=1,2,\dots ,k$ and $\mathit{j}=1,2,\dots ,m$, and where $n$ is the number of observations in the time series in the last call made to g13dj.
Constraint: if the transformation defined in tr in g13dj for the $\mathit{i}$th series is the log transformation, then ${\mathbf{z}}\left[\mathit{i}-1,\mathit{j}-1\right]>0.0$, and if it is the square-root transformation, then ${\mathbf{z}}\left[\mathit{i}-1,\mathit{j}-1\right]\ge 0.0$, for $\mathit{j}=1,2,\dots ,m$ and $\mathit{i}=1,2,\dots ,k$.
dnref
Type: array<System..::..Double>[]()[][]
An array of size [lref]
On entry: must contain the first $\left({\mathbf{lmax}}-1\right)×{\mathbf{k}}×{\mathbf{k}}+2×{\mathbf{k}}×{\mathbf{lmax}}+{\mathbf{k}}$ elements of the reference vector as returned on a successful exit from g13dj (or a previous call to g13dk).
On exit: the elements of ref are updated. The first $\left({\mathbf{lmax}}-1\right)×{\mathbf{k}}×{\mathbf{k}}$ elements store the $\psi$ weights ${\psi }_{1},{\psi }_{2},\dots ,{\psi }_{{l}_{\mathrm{max}}-1}$. The next ${\mathbf{k}}×{\mathbf{lmax}}$ elements contain the forecasts of the transformed series and the next ${\mathbf{k}}×{\mathbf{lmax}}$ elements contain the variances of the forecasts of the transformed variables; see g13dj. The last k elements are not updated.
v
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, m]
Note: dim1 must satisfy the constraint: $\mathrm{dim1}\ge {\mathbf{k}}$
On exit: ${\mathbf{v}}\left[\mathit{i}-1,\mathit{j}-1\right]$ contains an estimate of the $\mathit{i}$th component of ${\epsilon }_{n+{\mathbf{mlast}}+\mathit{j}}$, for $\mathit{i}=1,2,\dots ,k$ and $\mathit{j}=1,2,\dots ,m$.
predz
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, lmax]
Note: dim1 must satisfy the constraint: $\mathrm{dim1}\ge {\mathbf{k}}$
On entry: nonupdated values are kept intact.
On exit: ${\mathbf{predz}}\left[\mathit{i}-1,\mathit{j}-1\right]$ contains the updated forecast of ${z}_{\mathit{i},n+\mathit{j}}$, for $\mathit{i}=1,2,\dots ,k$ and $\mathit{j}={\mathbf{mlast}}+{\mathbf{m}}+1,\dots ,{l}_{\mathrm{max}}$.
The columns of predz corresponding to the new observations since the last call to either g13dj or g13dk are set equal to the corresponding columns of z.
sefz
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, lmax]
Note: dim1 must satisfy the constraint: $\mathrm{dim1}\ge {\mathbf{k}}$
On entry: nonupdated values are kept intact.
On exit: ${\mathbf{sefz}}\left[\mathit{i}-1,\mathit{j}-1\right]$ contains an estimate of the standard error of the corresponding element of predz, for $\mathit{i}=1,2,\dots ,k$ and $\mathit{j}={\mathbf{mlast}}+{\mathbf{m}}+1,\dots ,{l}_{\mathrm{max}}$.
The columns of sefz corresponding to the new observations since the last call to either g13dj or g13dk are set equal to zero.
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

Let ${Z}_{\mathit{t}}={\left({z}_{1\mathit{t}},{z}_{2\mathit{t}},\dots ,{z}_{k\mathit{t}}\right)}^{\mathrm{T}}$, for $\mathit{t}=1,2,\dots ,n$, denote a $k$-dimensional time series for which forecasts of ${\stackrel{^}{Z}}_{n+1},{\stackrel{^}{Z}}_{n+2},\dots ,{\stackrel{^}{Z}}_{n+{l}_{\mathrm{max}}}$ have been computed using g13dj. Given $m$ further observations ${Z}_{n+1},{Z}_{n+2},\dots ,{Z}_{n+m}$, where $m<{l}_{\mathrm{max}}$, g13dk updates the forecasts of ${Z}_{n+m+1},{Z}_{n+m+2},\dots ,{Z}_{n+{l}_{\mathrm{max}}}$ and their corresponding standard errors.
g13dk uses a multivariate version of the procedure described in Box and Jenkins (1976). The forecasts are updated using the $\psi$ weights, computed in g13dj. If ${Z}_{t}^{*}$ denotes the transformed value of ${Z}_{t}$ and ${\stackrel{^}{Z}}_{t}^{*}\left(l\right)$ denotes the forecast of ${Z}_{t+l}^{*}$ from time $t$ with a lead of $l$ (that is the forecast of ${Z}_{t+l}^{*}$ given observations ${Z}_{t}^{*},{Z}_{t-1}^{*},\dots \text{}$), then
 $Z^t+1*l=τ+ψlεt+1+ψl+1εt+ψl+2εt-1+⋯$
and
 $Z^t*l+1=τ+ψl+1εt+ψl+2εt-1+⋯$
where $\tau$ is a constant vector of length $k$ involving the differencing parameters and the mean vector $\mu$. By subtraction we obtain
 $Z^t+1*l=Z^t*l+1+ψlεt+1.$
Estimates of the residuals corresponding to the new observations are also computed as ${\epsilon }_{n+\mathit{l}}={Z}_{n+\mathit{l}}^{*}-{\stackrel{^}{Z}}_{n}^{*}\left(\mathit{l}\right)$, for $\mathit{l}=1,2,\dots ,m$. These may be of use in checking that the new observations conform to the previously fitted model.
On a successful exit, the reference array is updated so that g13dk may be called again should future series values become available, see [Further Comments].
When a transformation has been used the forecasts and their standard errors are suitably modified to give results in terms of the original series ${Z}_{t}$; see Granger and Newbold (1976).

# References

Box G E P and Jenkins G M (1976) Time Series Analysis: Forecasting and Control (Revised Edition) Holden–Day
Granger C W J and Newbold P (1976) Forecasting transformed series J. Roy. Statist. Soc. Ser. B 38 189–203
Wei W W S (1990) Time Series Analysis: Univariate and Multivariate Methods Addison–Wesley

# Error Indicators and Warnings

Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (KMAX) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{k}}<1$, or ${\mathbf{lmax}}<2$, or ${\mathbf{m}}\le 0$, or ${\mathbf{mlast}}+{\mathbf{m}}\ge {\mathbf{lmax}}$, or ${\mathbf{mlast}}<0$, or ${\mathbf{lref}}<\left({\mathbf{lmax}}-1\right)×{\mathbf{k}}×{\mathbf{k}}+2×{\mathbf{k}}×{\mathbf{lmax}}+{\mathbf{k}}$.
${\mathbf{ifail}}=2$
On entry, some of the elements of the reference vector, ref, have been corrupted since the most recent call to g13dj (or g13dk).
${\mathbf{ifail}}=3$
On entry, one or more of the elements of z is invalid, for the transformation being used; that is you may be trying to log or square root a series, some of whose values are negative.
${\mathbf{ifail}}=4$
This is an unlikely exit. For one of the series, overflow will occur if the forecasts are updated. You should check whether the elements of ref have been corrupted.
${\mathbf{ifail}}=-9000$
An error occured, see message report.
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-4000$
Invalid dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-8000$
Negative dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$

# Accuracy

The matrix computations are believed to be stable.

# Parallelism and Performance

None.

If a further ${m}^{*}$ observations, ${Z}_{n+{\mathbf{mlast}}+1},{Z}_{n+{\mathbf{mlast}}+2},\dots ,{Z}_{n+{\mathbf{mlast}}+{m}^{*}}$, become available, then forecasts of ${Z}_{n+{\mathbf{mlast}}+{m}^{*}+1},{Z}_{n+{\mathbf{mlast}}+{m}^{*}+2},\dots ,{Z}_{n+{l}_{\mathrm{max}}}$ may be updated by recalling g13dk with ${\mathbf{m}}={m}^{*}$. Note that m and the contents of the array z are the only quantities which need updating; mlast is updated on exit from the previous call. On a successful exit, v contains estimates of ${\epsilon }_{n+{\mathbf{mlast}}+1},{\epsilon }_{n+{\mathbf{mlast}}+2},\dots ,{\epsilon }_{n+{\mathbf{mlast}}+{m}^{*}}$; columns ${\mathbf{mlast}}+1,{\mathbf{mlast}}+2,\dots ,{\mathbf{mlast}}+{m}^{*}$ of predz contain the new observed values ${Z}_{n+{\mathbf{mlast}}+1},{Z}_{n+{\mathbf{mlast}}+2},\dots ,{Z}_{n+{\mathbf{mlast}}+{m}^{*}}$ and columns ${\mathbf{mlast}}+1,{\mathbf{mlast}}+2,\dots ,{\mathbf{mlast}}+{m}^{*}$ of sefz are set to zero.