hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_tsa_multi_varma_forecast (g13dj)

Purpose

nag_tsa_multi_varma_forecast (g13dj) computes forecasts of a multivariate time series. It is assumed that a vector ARMA model has already been fitted to the appropriately differenced/transformed time series using nag_tsa_multi_varma_estimate (g13dd). The standard deviations of the forecast errors are also returned. A reference vector is set up so that, should future series values become available, the forecasts and their standard errors may be updated by calling nag_tsa_multi_varma_update (g13dk).

Syntax

[qq, predz, sefz, ref, ifail] = g13dj(z, tr, id, delta, ip, iq, mean, par, qq, v, lmax, lref, 'k', k, 'n', n, 'lpar', lpar)
[qq, predz, sefz, ref, ifail] = nag_tsa_multi_varma_forecast(z, tr, id, delta, ip, iq, mean, par, qq, v, lmax, lref, 'k', k, 'n', n, 'lpar', lpar)

Description

Let the vector Zt = (z1t,z2t,,zkt)T Zt = (z1t,z2t,,zkt)T , for t = 1,2,,nt=1,2,,n, denote a kk-dimensional time series for which forecasts of Zn + 1,Zn + 2,,Zn + lmaxZn+1,Zn+2,,Zn+lmax are required. Let Wt = (w1t,w2t,,wkt)T Wt = (w1t,w2t,,wkt)T  be defined as follows:
wit = δi(B)zit * ,  i = 1,2,,k,
wit=δi(B)zit*,  i=1,2,,k,
where δi(B)δi(B) is the differencing operator applied to the iith series and where zit * zit* is equal to either zitzit, sqrt(zit)zit or loge(zit) loge(zit) depending on whether or not a transformation was required to stabilize the variance before fitting the model.
If the order of differencing required for the iith series is didi, then the differencing operator for the iith series is defined by δi(B) = 1δi1Bδi2B2δidiBdiδi(B)=1-δi1B-δi2B2--δidiBdi where BB is the backward shift operator; that is, BZt = Zt1BZt=Zt-1. The differencing parameters δijδij, for i = 1,2,,ki=1,2,,k and j = 1,2,,dij=1,2,,di, must be supplied by you. If the iith series does not require differencing, then di = 0di=0.
WtWt is assumed to follow a multivariate ARMA model of the form:
Wtμ = φ1(Wt1μ) + φ2(Wt2μ) + + φp(Wtpμ) + εtθ1εt1θqεtq,
Wt-μ=ϕ1(Wt-1-μ)+ϕ2(Wt-2-μ)++ϕp(Wt-p-μ)+εt-θ1εt-1--θqεt-q,
(1)
where εt = (ε1t,ε2t,,εkt)T εt = (ε1t,ε2t,,εkt)T , for t = 1,2,,nt=1,2,,n, is a vector of kk residual series assumed to be Normally distributed with zero mean and positive definite covariance matrix ΣΣ. The components of εtεt are assumed to be uncorrelated at non-simultaneous lags. The φiϕi and θjθj are kk by kk matrices of parameters. The matrices φiϕi, for i = 1,2,,pi=1,2,,p, are the autoregressive (AR) parameter matrices, and the matrices θiθi, for i = 1,2,,qi=1,2,,q, the moving average (MA) parameter matrices. The parameters in the model are thus the pp (kk by kk) φϕ-matrices, the qq (kk by kk) θθ-matrices, the mean vector μμ and the residual error covariance matrix ΣΣ. The ARMA model (1) must be both stationary and invertible; see nag_tsa_uni_arma_roots (g13dx) for a method of checking these conditions.
The ARMA model (1) may be rewritten as
φ(B)(δ(B)Zt * μ) = θ(B)εt,
ϕ(B)(δ(B)Zt*-μ)=θ(B)εt,
where φ(B)ϕ(B) and θ(B)θ(B) are the autoregressive and moving average polynomials and δ(B)δ(B) denotes the kk by kk diagonal matrix whose iith diagonal elements is δi(B)δi(B) and Zt * = (z1t * , z2t * zkt * )T Zt* = ( z 1t * , z2t* zkt* )T .
This may be rewritten as
φ(B)δ(B)Zt * = φ(B)μ + θ(B)εt
ϕ(B)δ(B)Zt*=ϕ(B)μ+θ(B)εt
or
Zt * = τ + ψ (B)εt = τ + εt + ψ1εt 1 + ψ2εt 2 +
Zt*=τ+ψ (B)εt=τ+εt+ψ1εt- 1+ψ2εt- 2+
where ψ(B) = δ1(B)φ1(B)θ(B)ψ(B)=δ-1(B)ϕ-1(B)θ(B) and τ = δ1(B)μτ=δ-1(B)μ is a vector of length kk.
Forecasts are computed using a multivariate version of the procedure described in Box and Jenkins (1976). If n * (l)Z^n*(l) denotes the forecast of Zn + l * Zn+l*, then n * (l)Z^n*(l) is taken to be that linear function of Zn * ,Zn1 * ,Zn*,Zn-1*, which minimizes the elements of E{en(l)en(l)}E{en(l)en(l)} where en(l) = Zn + l * n * (l)en(l)=Zn+l*-Z^n*(l) is the forecast error. n * (l)Z^n*(l) is referred to as the linear minimum mean square error forecast of Zn + l * Zn+l*.
The linear predictor which minimizes the mean square error may be expressed as
n * (l) = τ + ψlεn + ψl + 1εn1 + ψl + 2εn2 + .
Z^n*(l)=τ+ψlεn+ψl+1εn-1+ψl+2εn-2+.
The forecast error at tt for lead ll is then
en(l) = Zn + l * n * (l) = εn + l + ψ1εn + l1 + ψ2εn + l2 + + ψl1εn + 1.
en(l)=Zn+l*-Z^n*(l)=εn+l+ψ1εn+l-1+ψ2εn+l-2++ψl-1εn+1.
Let d = max (di)d=max(di), for i = 1,2,,ki=1,2,,k. Unless q = 0q=0 the function requires estimates of εtεt, for t = d + 1,,nt=d+1,,n, which are obtainable from nag_tsa_multi_varma_estimate (g13dd). The terms εtεt are assumed to be zero, for t = n + 1,,n + lmaxt=n+1,,n+lmax. You may use nag_tsa_multi_varma_update (g13dk) to update these lmaxlmax forecasts should further observations, Zn + 1,Zn + 2,Zn+1,Zn+2,, become available. Note that when lmaxlmax or more further observations are available then nag_tsa_multi_varma_forecast (g13dj) must be used to produce new forecasts for Zn + lmax + 1,Zn + lmax + 2,Zn+lmax+1,Zn+lmax+2,, should they be required.
When a transformation has been used the forecasts and their standard errors are suitably modified to give results in terms of the original series, ZtZt; 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

Parameters

The output quantities k, n, kmax, ip, iq, par, npar, qq and v from nag_tsa_multi_varma_estimate (g13dd) are suitable for input to nag_tsa_multi_varma_forecast (g13dj).

Compulsory Input Parameters

1:     z(kmax,n) – double array
kmax, the first dimension of the array, must satisfy the constraint kmaxkkmaxk.
z(i,t)zit must contain, zitzit, the iith component of ZtZt, for i = 1,2,,ki=1,2,,k and t = 1,2,,nt=1,2,,n.
Constraints:
  • if tr(i) = 'L'tri='L', z(i,t) > 0.0zit>0.0;
  • if tr(i) = 'S'tri='S', z(i,t)0.0zit0.0, for i = 1,2,,ki=1,2,,k and t = 1,2,,nt=1,2,,n.
2:     tr(k) – cell array of strings
k, the dimension of the array, must satisfy the constraint k1k1.
tr(i)tri indicates whether the iith time series is to be transformed, for i = 1,2,,ki=1,2,,k.
tr(i) = 'N'tri='N'
No transformation is used.
tr(i) = 'L'tri='L'
A log transformation is used.
tr(i) = 'S'tri='S'
A square root transformation is used.
Constraint: tr(i) = 'N'tri='N', 'L''L' or 'S''S', for i = 1,2,,ki=1,2,,k.
3:     id(k) – int64int32nag_int array
k, the dimension of the array, must satisfy the constraint k1k1.
id(i)idi must specify, didi, the order of differencing required for the iith series.
Constraint: 0id(i) < nmax (ip,iq)0idi<n-max(ip,iq), for i = 1,2,,ki=1,2,,k.
4:     delta(kmax, : :) – double array
The first dimension of the array delta must be at least kk
The second dimension of the array must be at least max (1,d)max(1,d), where d = max (id(i))d=max(idi)
If id(i) > 0idi>0, then delta(i,j)deltaij must be set equal to δijδij, for j = 1,2,,dij=1,2,,di and i = 1,2,,ki=1,2,,k.
If d = 0d=0, delta is not referenced.
5:     ip – int64int32nag_int scalar
pp, the number of AR parameter matrices.
Constraint: ip0ip0.
6:     iq – int64int32nag_int scalar
qq, the number of MA parameter matrices.
Constraint: iq0iq0.
7:     mean – string (length ≥ 1)
mean = 'M'mean='M', if components of μμ have been estimated and mean = 'Z'mean='Z', if all elements of μμ are to be taken as zero.
Constraint: mean = 'M'mean='M' or 'Z''Z'.
8:     par(lpar) – double array
lpar, the dimension of the array, must satisfy the constraint
  • if mean = 'Z'mean='Z', lparmax (1,(ip + iq) × k × k)lparmax(1,(ip+iq)×k×k);
  • if mean = 'M'mean='M', lpar(ip + iq) × k × k + klpar(ip+iq)×k×k+k.
Must contain the parameter estimates read in row by row in the order φ1,φ2,,φpϕ1,ϕ2,,ϕp, θ1,θ2,,θqθ1,θ2,,θq, μμ.
Thus,
  • if ip > 0ip>0, par((l1) × k × k + (i1) × k + j)par(l-1)×k×k+(i-1)×k+j must be set equal to an estimate of the (i,j)(i,j)th element of φlϕl, for l = 1,2,,pl=1,2,,p, i = 1,2,,ki=1,2,,k and j = 1,2,,kj=1,2,,k;
  • if iq > 0iq>0, par(p × k × k + (l1) × k × k + (i1) × k + j)parp×k×k+(l-1)×k×k+(i-1)×k+j must be set equal to an estimate of the (i,j)(i,j)th element of θlθl, for l = 1,2,,ql=1,2,,q, i = 1,2,,ki=1,2,,k and j = 1,2,,kj=1,2,,k;
  • if mean = 'M'mean='M', par((p + q) × k × k + i)par(p+q)×k×k+i must be set equal to an estimate of the iith component of μμ, for i = 1,2,,ki=1,2,,k.
Constraint: the first ip × k × kip×k×k elements of par must satisfy the stationarity condition and the next iq × k × kiq×k×k elements of par must satisfy the invertibility condition.
9:     qq(kmax,k) – double array
kmax, the first dimension of the array, must satisfy the constraint kmaxkkmaxk.
qq(i,j)qqij must contain an estimate of the (i,j)(i,j)th element of ΣΣ. The lower triangle only is needed.
Constraint: qqqq must be positive definite.
10:   v(kmax, : :) – double array
The first dimension of the array v must be at least kk
The second dimension of the array must be at least max (1,nd)max(1,n-d), where d = max (id(i))d=max(idi)
v(i,t)vit must contain an estimate of the iith component of εt + dεt+d, for i = 1,2,,ki=1,2,,k and t = 1,2,,ndt=1,2,,n-d.
If q = 0q=0, v is not used.
11:   lmax – int64int32nag_int scalar
The number, lmaxlmax, of forecasts required.
Constraint: lmax1lmax1.
12:   lref – int64int32nag_int scalar
The dimension of the array ref as declared in the (sub)program from which nag_tsa_multi_varma_forecast (g13dj) is called.
Constraint: lref(lmax1) × k × k + 2 × k × lmax + klref(lmax-1)×k×k+2×k×lmax+k.

Optional Input Parameters

1:     k – int64int32nag_int scalar
Default: The dimension of the arrays tr, id and the first dimension of the arrays z, delta, qq, v and the second dimension of the array qq. (An error is raised if these dimensions are not equal.)
kk, the dimension of the multivariate time series.
Constraint: k1k1.
2:     n – int64int32nag_int scalar
Default: The second dimension of the array z.
nn, the number of observations in the series, ZtZt, prior to differencing.
Constraint: n3n3.
The total number of observations must exceed the total number of parameters in the model; that is
  • if mean = 'Z'mean='Z', n × k > (ip + iq) × k × k + k × (k + 1) / 2n×k>(ip+iq)×k×k+k×(k+1)/2;
  • if mean = 'M'mean='M', n × k > (ip + iq) × k × k + k + k × (k + 1) / 2n×k>(ip+iq)×k×k+k+k×(k+1)/2,
(see the parameters ip, iq and mean).
3:     lpar – int64int32nag_int scalar
Default: The dimension of the array par.
The dimension of the array par as declared in the (sub)program from which nag_tsa_multi_varma_forecast (g13dj) is called.
Constraints:
  • if mean = 'Z'mean='Z', lparmax (1,(ip + iq) × k × k)lparmax(1,(ip+iq)×k×k);
  • if mean = 'M'mean='M', lpar(ip + iq) × k × k + klpar(ip+iq)×k×k+k.

Input Parameters Omitted from the MATLAB Interface

kmax work lwork iwork liwork

Output Parameters

1:     qq(kmax,k) – double array
kmaxkkmaxk.
If ifail1ifail1, then the upper triangle is set equal to the lower triangle.
2:     predz(kmax,lmax) – double array
kmaxkkmaxk.
predz(i,l)predzil contains the forecast of zi,n + lzi,n+l, for i = 1,2,,ki=1,2,,k and l = 1,2,,lmaxl=1,2,,lmax.
3:     sefz(kmax,lmax) – double array
kmaxkkmaxk.
sefz(i,l)sefzil contains an estimate of the standard error of the forecast of zi,n + lzi,n+l, for i = 1,2,,ki=1,2,,k and l = 1,2,,lmaxl=1,2,,lmax.
4:     ref(lref) – double array
The reference vector which may be used to update forecasts using nag_tsa_multi_varma_update (g13dk). The first (lmax1) × k × k(lmax-1)×k×k elements contain the ψψ weight matrices, ψ1,ψ2,,ψlmax1ψ1,ψ2,,ψlmax-1. The next k × lmaxk×lmax elements contain the forecasts of the transformed series n + 1 * ,n + 2 * ,, n + lmax * Z^n+1*,Z^n+2*,, Z^n+lmax* and the next k × lmaxk×lmax contain the variances of the forecasts of the transformed variables. The last k elements are used to store the transformations for the series.
5:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,k < 1k<1,
orn < 3n<3,
orkmax < kkmax<k,
orid(i) < 0idi<0 for some i = 1,2,,ki=1,2,,k,
orid(i)nmax (ip,iq)idin-max(ip,iq) for some i = 1,2,,ki=1,2,,k,
orip < 0ip<0,
oriq < 0iq<0,
ormean'M'mean'M' or 'Z''Z',
orlpar < (ip + iq) × k × k + klpar<(ip+iq)×k×k+k, and mean = 'M'mean='M',
orlpar < (ip + iq) × k × klpar<(ip+iq)×k×k and mean = 'Z'mean='Z',
orn × k(ip + iq) × k × k + k + k(k + 1) / 2n×k(ip+iq)×k×k+k+kk+1/2, and mean = 'M'mean='M',
orn × k(ip + iq) × k × k + k(k + 1) / 2n×k(ip+iq)×k×k+kk+1/2 and mean = 'Z'mean='Z',
orlmax < 1lmax<1,
orlref < (lmax1) × k × k + 2 × k × lmax + klref<(lmax-1)×k×k+2×k×lmax+k,
orlwork is too small,
orliwork is too small.
  ifail = 2ifail=2
On entry,at least one of the first kk elements of tr is not equal to 'N', 'L' or 'S'.
  ifail = 3ifail=3
On entry, one or more of the transformations requested cannot be computed; that is, you may be trying to log or square-root a series, some of whose values are negative.
  ifail = 4ifail=4
On entry, either qq is not positive definite or the autoregressive parameter matrices are extremely close to or outside the stationarity region, or the moving average parameter matrices are extremely close to or outside the invertibility region. To proceed, you must supply different parameter estimates in the arrays par and qq.
  ifail = 5ifail=5
This is an unlikely exit brought about by an excessive number of iterations being needed to evaluate the eigenvalues of the matrices required to check for stationarity and invertibility; see nag_tsa_uni_arma_roots (g13dx). All output parameters are undefined.
  ifail = 6ifail=6
This is an unlikely exit which could occur if qq is nearly non positive definite. In this case the standard deviations of the forecast errors may be non-positive. To proceed, you must supply different parameter estimates in the array qq.
  ifail = 7ifail=7
This is an unlikely exit. For one of the series, overflow will occur if the forecasts are computed. You should check whether the transformations requested in the array tr are sensible. All output parameters are undefined.

Accuracy

The matrix computations are believed to be stable.

Further Comments

The same differencing operator does not have to be applied to all the series. For example, suppose we have k = 2k=2, and wish to apply the second order differencing operator 22 to the first series and the first-order differencing operator  to the second series:
w1t = 2z1t = (1B)2z1t = (12B + B2)Z1t,   and
w2t = z2t = (1B)z2t.
w1t=2z1t= (1-B) 2z1t=(1-2B+B2)Z1t,   and w2t=z2t=(1-B)z2t.
Then d1 = 2,d2 = 1d1=2,d2=1, d = max (d1,d2) = 2d=max(d1,d2)=2, and
delta =
[ δ11 δ12 δ21 ]
=
[ 2 − 1 1 ]
.
delta=[ δ11 δ12 δ21 ]=[ 2 -1 1 ] .
Note:  although differencing may already have been applied prior to the model fitting stage, the differencing parameters supplied in delta are part of the model definition and are still required by this function to produce the forecasts.
nag_tsa_multi_varma_forecast (g13dj) should not be used when the moving average parameters lie close to the boundary of the invertibility region. The function does test for both invertibility and stationarity but if in doubt, you may use nag_tsa_uni_arma_roots (g13dx), before calling this function, to check that the VARMA model being used is invertible.
On a successful exit, the output quantities k, lmax, kmax, ref and lref will be suitable for input to nag_tsa_multi_varma_update (g13dk).

Example

function nag_tsa_multi_varma_forecast_example
z = [-1.49, -1.62, 5.2, 6.23, 6.21, 5.86, 4.09, 3.18, 2.62, 1.49, 1.17, ...
    0.85, -0.35, 0.24, 2.44, 2.58, 2.04, 0.4, 2.26, 3.34, 5.09, 5, 4.78, ...
    4.11, 3.45, 1.65, 1.29, 4.09, 6.32, 7.5, 3.89, 1.58, 5.21, 5.25, 4.93, ...
    7.38, 5.87, 5.81, 9.68, 9.07, 7.29, 7.84, 7.55, 7.32, 7.97, 7.76, 7, 8.35;
     7.34, 6.35, 6.96, 8.54, 6.62, 4.97, 4.55, 4.81, 4.75, ...
    4.76, 10.88, 10.01, 11.62, 10.36, 6.4, 6.24, 7.93, 4.04, 3.73, 5.6, ...
    5.35, 6.81, 8.27, 7.68, 6.65, 6.08, 10.25, 9.14, 17.75, 13.3, ...
    9.63, 6.8, 4.08, 5.06, 4.94, 6.65, 7.94, 10.76, 11.89, ...
    5.85, 9.01, 7.5, 10.02, 10.38, 8.15, 8.37, 10.73, 12.14];
tr = {'N'; 'N'};
id = [int64(0);0];
delta = [0;
     0];
ip = int64(1);
iq = int64(0);
mean_p = 'M';
par = [0.8016071892386086;
     0.0648134906597352;
     0;
     0.575015951133362;
     4.271122828253269;
     7.825342792089621];
qq = [2.964154253391392, 0.6372583252520638;
     0.6372583252520638, 5.379903126133676];
v = [-3.326133715726029, -1.241508590516912, 5.746865699837245, 1.270368439927496, ...
    0.3223077197693467, 0.112781765620811, -1.269713458557113, -0.7336470675276869, ...
    -0.5810360328920845, -1.25824719747888, -0.673079208545849, -1.133223470827074, ...
    -2.02032143339675, -0.572742526272592, 1.235974230307894, -0.1309001630044928, ...
    -0.7727550109923405, -2.089421928018445, 1.337338340999243, 0.9464411511199494, ...
    1.709504159208547, 0.2328949507059163, -0.009588098625822217, -0.5978622133565419, ...
     -0.6825454370774304, -1.886726796800422, -0.7668901664948766, ...
    2.051416165579926, 2.108859010344129, 0.9432308237617111, -3.324245626104025, ...
    -2.50257816223142, 3.162556623476816, 0.4690152211351468, 0.05343371271906172, ...
    2.767725632154585, -0.8170430505081534, 0.2497744022910866, 3.985096789984951, ...
    0.1996377231860347, -0.6999084077936142, 1.072141758566346, 0.4391261753813116, ...
    0.2782622637979761, 1.08929906068535, 0.5027884718514648, -0.103132986353569, 1.703128639510798;
     -0.1864812965451277, -1.196262944870486, -0.01699715324845752, 1.212243116560191, ...
    -1.61628208623052, -2.162251460054466, -1.633475140684418, -1.131968441208406, ...
    -1.34147258850308, -1.296971631435079, 4.817278209053589, 0.4281805881174119, ...
    2.538444465603437, 0.3526687842787246, -2.882811117293238, -0.7657479508051256, ...
    1.016254601376212, -3.84552235603917, -1.918710306130392, 0.1295446387209505, ...
    -1.195735189898436, 0.4080187978849044, 1.028495509230196, -0.4010277794245127, ...
    -1.091768368255828, -1.069501938588466, 3.42825715355755, -0.07955936266856867, ...
    9.168708343089461, -0.2321789961687832, -1.343358013625323, -2.063049472965885, ...
    -3.15575433125847, -0.6117109441757265, -1.29522657628642, 0.4837753378495833, ...
    0.7904980614115339, 2.868727484449496, 2.377182502253417, -4.312585522527284, ...
    2.320510822318223, -1.0065395832632, 2.381734502948175, 1.292694306092105, ...
    -1.144311436315907, 0.3579741347114898, 2.591470625462152, 2.644432980787418];
lmax = int64(5);
lref = int64(150);
[qqOut, predz, sefz, ref, ifail] = ...
    nag_tsa_multi_varma_forecast(z, tr, id, delta, ip, iq, mean_p, par, qq, v, lmax, lref)
 

qqOut =

    2.9642    0.6373
    0.6373    5.3799


predz =

    7.8204    7.2771    6.7732    6.3300    5.9521
   10.3063    9.2520    8.6457    8.2970    8.0966


sefz =

    1.7217    2.2266    2.5095    2.6817    2.7898
    2.3195    2.6756    2.7833    2.8180    2.8294


ref =

    0.8016
         0
    0.0648
    0.5750
    0.6426
         0
    0.0892
    0.3306
    0.5151
         0
    0.0930
    0.1901
    0.4129
         0
    0.0868
    0.1093
    7.8204
   10.3063
    7.2771
    9.2520
    6.7732
    8.6457
    6.3300
    8.2970
    5.9521
    8.0966
    2.9642
    5.3799
    4.9577
    7.1587
    6.2975
    7.7469
    7.1914
    7.9414
    7.7830
    8.0057
  100.0000
  100.0000
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0


ifail =

                    0


function g13dj_example
z = [-1.49, -1.62, 5.2, 6.23, 6.21, 5.86, 4.09, 3.18, 2.62, 1.49, 1.17, ...
    0.85, -0.35, 0.24, 2.44, 2.58, 2.04, 0.4, 2.26, 3.34, 5.09, 5, 4.78, ...
    4.11, 3.45, 1.65, 1.29, 4.09, 6.32, 7.5, 3.89, 1.58, 5.21, 5.25, 4.93, ...
    7.38, 5.87, 5.81, 9.68, 9.07, 7.29, 7.84, 7.55, 7.32, 7.97, 7.76, 7, 8.35;
     7.34, 6.35, 6.96, 8.54, 6.62, 4.97, 4.55, 4.81, 4.75, ...
    4.76, 10.88, 10.01, 11.62, 10.36, 6.4, 6.24, 7.93, 4.04, 3.73, 5.6, ...
    5.35, 6.81, 8.27, 7.68, 6.65, 6.08, 10.25, 9.14, 17.75, 13.3, ...
    9.63, 6.8, 4.08, 5.06, 4.94, 6.65, 7.94, 10.76, 11.89, ...
    5.85, 9.01, 7.5, 10.02, 10.38, 8.15, 8.37, 10.73, 12.14];
tr = {'N'; 'N'};
id = [int64(0);0];
delta = [0;
     0];
ip = int64(1);
iq = int64(0);
mean_p = 'M';
par = [0.8016071892386086;
     0.0648134906597352;
     0;
     0.575015951133362;
     4.271122828253269;
     7.825342792089621];
qq = [2.964154253391392, 0.6372583252520638;
     0.6372583252520638, 5.379903126133676];
v = [-3.326133715726029, -1.241508590516912, 5.746865699837245, 1.270368439927496, ...
    0.3223077197693467, 0.112781765620811, -1.269713458557113, -0.7336470675276869, ...
    -0.5810360328920845, -1.25824719747888, -0.673079208545849, -1.133223470827074, ...
    -2.02032143339675, -0.572742526272592, 1.235974230307894, -0.1309001630044928, ...
    -0.7727550109923405, -2.089421928018445, 1.337338340999243, 0.9464411511199494, ...
    1.709504159208547, 0.2328949507059163, -0.009588098625822217, -0.5978622133565419, ...
     -0.6825454370774304, -1.886726796800422, -0.7668901664948766, ...
    2.051416165579926, 2.108859010344129, 0.9432308237617111, -3.324245626104025, ...
    -2.50257816223142, 3.162556623476816, 0.4690152211351468, 0.05343371271906172, ...
    2.767725632154585, -0.8170430505081534, 0.2497744022910866, 3.985096789984951, ...
    0.1996377231860347, -0.6999084077936142, 1.072141758566346, 0.4391261753813116, ...
    0.2782622637979761, 1.08929906068535, 0.5027884718514648, -0.103132986353569, 1.703128639510798;
     -0.1864812965451277, -1.196262944870486, -0.01699715324845752, 1.212243116560191, ...
    -1.61628208623052, -2.162251460054466, -1.633475140684418, -1.131968441208406, ...
    -1.34147258850308, -1.296971631435079, 4.817278209053589, 0.4281805881174119, ...
    2.538444465603437, 0.3526687842787246, -2.882811117293238, -0.7657479508051256, ...
    1.016254601376212, -3.84552235603917, -1.918710306130392, 0.1295446387209505, ...
    -1.195735189898436, 0.4080187978849044, 1.028495509230196, -0.4010277794245127, ...
    -1.091768368255828, -1.069501938588466, 3.42825715355755, -0.07955936266856867, ...
    9.168708343089461, -0.2321789961687832, -1.343358013625323, -2.063049472965885, ...
    -3.15575433125847, -0.6117109441757265, -1.29522657628642, 0.4837753378495833, ...
    0.7904980614115339, 2.868727484449496, 2.377182502253417, -4.312585522527284, ...
    2.320510822318223, -1.0065395832632, 2.381734502948175, 1.292694306092105, ...
    -1.144311436315907, 0.3579741347114898, 2.591470625462152, 2.644432980787418];
lmax = int64(5);
lref = int64(150);
[qqOut, predz, sefz, ref, ifail] = ...
    g13dj(z, tr, id, delta, ip, iq, mean_p, par, qq, v, lmax, lref)
 

qqOut =

    2.9642    0.6373
    0.6373    5.3799


predz =

    7.8204    7.2771    6.7732    6.3300    5.9521
   10.3063    9.2520    8.6457    8.2970    8.0966


sefz =

    1.7217    2.2266    2.5095    2.6817    2.7898
    2.3195    2.6756    2.7833    2.8180    2.8294


ref =

    0.8016
         0
    0.0648
    0.5750
    0.6426
         0
    0.0892
    0.3306
    0.5151
         0
    0.0930
    0.1901
    0.4129
         0
    0.0868
    0.1093
    7.8204
   10.3063
    7.2771
    9.2520
    6.7732
    8.6457
    6.3300
    8.2970
    5.9521
    8.0966
    2.9642
    5.3799
    4.9577
    7.1587
    6.2975
    7.7469
    7.1914
    7.9414
    7.7830
    8.0057
  100.0000
  100.0000
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0
         0


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013