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_regmat_partial (g13dp)

Purpose

nag_tsa_multi_regmat_partial (g13dp) calculates the sample partial autoregression matrices of a multivariate time series. A set of likelihood ratio statistics and their significance levels are also returned. These quantities are useful for determining whether the series follows an autoregressive model and, if so, of what order.

Syntax

[maxlag, parlag, se, qq, x, pvalue, loglhd, ifail] = g13dp(k, z, m, 'n', n)
[maxlag, parlag, se, qq, x, pvalue, loglhd, ifail] = nag_tsa_multi_regmat_partial(k, z, m, 'n', n)

Description

Let Wt = (w1t,w2t,,wkt)T Wt = (w1t,w2t,,wkt)T , for t = 1,2,,nt=1,2,,n, denote a vector of kk time series. The partial autoregression matrix at lag ll, PlPl, is defined to be the last matrix coefficient when a vector autoregressive model of order ll is fitted to the series. PlPl has the property that if WtWt follows a vector autoregressive model of order pp then Pl = 0Pl=0 for l > pl>p.
Sample estimates of the partial autoregression matrices may be obtained by fitting autoregressive models of successively higher orders by multivariate least squares; see Tiao and Box (1981) and Wei (1990). These models are fitted using a QRQR algorithm based on the functions nag_correg_linregm_obs_edit (g02dc) and nag_correg_linregm_var_del (g02df). They are calculated up to lag mm, which is usually taken to be at most n / 4n/4.
The function also returns the asymptotic standard errors of the elements of lP^l and an estimate of the residual variance-covariance matrix Σ̂lΣ^l, for l = 1,2,,ml=1,2,,m. If SlSl denotes the residual sum of squares and cross-products matrix after fitting an AR(l)AR(l) model to the series then under the null hypothesis H0 : Pl = 0H0:Pl=0 the test statistic
Xl = ((nm1)(1/2)lk) log((|Sl|)/(|Sl1|))
Xl= - ( (n-m-1) -12-lk ) log( |Sl| |Sl-1| )
is asymptotically distributed as χ2χ2 with k2k2 degrees of freedom. XlXl provides a useful diagnostic aid in determining the order of an autoregressive model. (Note that Σ̂l = Sl / (nl)Σ^l=Sl/(n-l).) The function also returns an estimate of the maximum of the log-likelihood function for each AR model that has been fitted.

References

Tiao G C and Box G E P (1981) Modelling multiple time series with applications J. Am. Stat. Assoc. 76 802–816
Wei W W S (1990) Time Series Analysis: Univariate and Multivariate Methods Addison–Wesley

Parameters

Compulsory Input Parameters

1:     k – int64int32nag_int scalar
kk, the number of time series.
Constraint: k1k1.
2:     z(kmax,n) – double array
kmax, the first dimension of the array, must satisfy the constraint kmaxkkmaxk.
z(i,t)zit must contain the observation witwit, for i = 1,2,,ki=1,2,,k and t = 1,2,,nt=1,2,,n.
3:     m – int64int32nag_int scalar
mm, the number of partial autoregression matrices to be computed. If in doubt set m = 10m=10.
Constraint: m1m1 and nm(k × m + 1)kn-m-(k×m+1)k.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The second dimension of the array z.
nn, the number of observations in the time series.
Constraint: n4n4.

Input Parameters Omitted from the MATLAB Interface

kmax work lwork iwork

Output Parameters

1:     maxlag – int64int32nag_int scalar
The maximum lag up to which partial autoregression matrices (along with their likelihood ratio statistics and their significance levels) have been successfully computed. On a successful exit maxlag will equal m. If ifail = 2ifail=2 on exit then maxlag will be less than m.
2:     parlag(kmax,kmax,m) – double array
kmaxkkmaxk.
parlag(i,j,l)parlag(i,j,l) contains an estimate of the (i,j)(i,j)th element of the partial autoregression matrix at lag ll, l(ij)P^l(ij), for l = 1,2,,maxlagl=1,2,,maxlag, i = 1,2,,ki=1,2,,k and j = 1,2,,kj=1,2,,k.
3:     se(kmax,kmax,m) – double array
kmaxkkmaxk.
se(i,j,l)se(i,j,l) contains an estimate of the standard error of the corresponding element in the array parlag.
4:     qq(kmax,kmax,m) – double array
kmaxkkmaxk.
qq(i,j,l)qq(i,j,l) contains an estimate of the (i,j)(i,j)th element of the corresponding variance-covariance matrix Σ̂lΣ^l, for l = 1,2,,maxlagl=1,2,,maxlag, i = 1,2,,ki=1,2,,k and j = 1,2,,kj=1,2,,k.
5:     x(m) – double array
x(l)xl contains XlXl, the likelihood ratio statistic at lag ll, for l = 1,2,,maxlagl=1,2,,maxlag.
6:     pvalue(m) – double array
pvalue(l)pvaluel contains the significance level of the statistic in the corresponding element of x.
7:     loglhd(m) – double array
loglhd(l)loglhdl contains an estimate of the maximum of the log-likelihood function when an AR(l)AR(l) model has been fitted to the series, for l = 1,2,,maxlagl=1,2,,maxlag.
8:     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:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

  ifail = 1ifail=1
On entry,k < 1k<1,
orn < 4n<4,
orkmax < kkmax<k,
orm < 1m<1,
ornm(k × m + 1) < kn-m-(k×m+1)<k,
orlwork is too small.
W ifail = 2ifail=2
The recursive equations used to compute the sample partial autoregression matrices have broken down at lag maxlag + 1maxlag+1. This exit could occur if the regression model is overparameterised. For your settings of kk and nn the value returned by maxlag is the largest permissible value of mm for which the model is not overparameterised. All output quantities in the arrays parlag, se, qq, x, pvalue and loglhd up to and including lag maxlag will be correct.

Accuracy

The computations are believed to be stable.

Further Comments

The time taken is roughly proportional to nmknmk.
For each order of autoregressive model that has been estimated, nag_tsa_multi_regmat_partial (g13dp) returns the maximum of the log-likelihood function. An alternative means of choosing the order of a vector AR process is to choose the order for which Akaike's information criterion is smallest. That is, choose the value of ll for which 2 × loglhd(l) + 2lk2-2×loglhdl+2lk2 is smallest. You should be warned that this does not always lead to the same choice of ll as indicated by the sample partial autoregression matrices and the likelihood ratio statistics.

Example

function nag_tsa_multi_regmat_partial_example
k = int64(2);
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];
m = int64(10);
[maxlag, parlag, se, qq, x, pvalue, loglhd, ifail] = nag_tsa_multi_regmat_partial(k, z, m);
 maxlag, x, pvalue, loglhd, ifail
 

maxlag =

                   10


x =

   49.8836
    3.3467
   13.9619
    7.0706
    5.1838
    2.0826
    5.0744
   10.9907
    3.9365
    3.1748


pvalue =

    0.0000
    0.5016
    0.0074
    0.1322
    0.2690
    0.7206
    0.2797
    0.0267
    0.4147
    0.5290


loglhd =

 -196.2102
 -190.6563
 -177.2009
 -168.7939
 -161.7405
 -157.1822
 -149.8045
 -136.4157
 -129.8435
 -123.8453


ifail =

                    0


function g13dp_example
k = int64(2);
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];
m = int64(10);
[maxlag, parlag, se, qq, x, pvalue, loglhd, ifail] = g13dp(k, z, m);
 maxlag, x, pvalue, loglhd, ifail
 

maxlag =

                   10


x =

   49.8836
    3.3467
   13.9619
    7.0706
    5.1838
    2.0826
    5.0744
   10.9907
    3.9365
    3.1748


pvalue =

    0.0000
    0.5016
    0.0074
    0.1322
    0.2690
    0.7206
    0.2797
    0.0267
    0.4147
    0.5290


loglhd =

 -196.2102
 -190.6563
 -177.2009
 -168.7939
 -161.7405
 -157.1822
 -149.8045
 -136.4157
 -129.8435
 -123.8453


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