NAG Library Function Document
nag_tsa_multi_part_regsn (g13dpc) 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.
||nag_tsa_multi_part_regsn (Integer k,
const double z,
Let , for , denote a vector of time series. The partial autoregression matrix at lag , , is defined to be the last matrix coefficient when a vector autoregressive model of order is fitted to the series. has the property that if follows a vector autoregressive model of order then for .
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
algorithm based on the functions nag_regsn_mult_linear_addrem_obs (g02dcc)
and nag_regsn_mult_linear_delete_var (g02dfc)
. They are calculated up to lag
, which is usually taken to be at most
The function also returns the asymptotic standard errors of the elements of
and an estimate of the residual variance-covariance matrix
denotes the residual sum of squares and cross-products matrix after fitting an
model to the series then under the null hypothesis
the test statistic
is asymptotically distributed as
degrees of freedom.
provides a useful diagnostic aid in determining the order of an autoregressive model. (Note that
.) The function also returns an estimate of the maximum of the log-likelihood function for each AR model that has been fitted.
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
k – IntegerInput
On entry: , the number of time series.
n – IntegerInput
On entry: , the number of observations in the time series.
z – const doubleInput
On entry: must contain the value for the th series at time , for and .
m – IntegerInput
On entry: , the number of partial autoregression matrices to be computed. If in doubt set .
maxlag – Integer *Output
: 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 MATRIX_ILL_CONDITIONED
on exit then maxlag
will be less than m
parlag – doubleOutput
On exit: contains an estimate of the th element of the partial autoregression matrix at lag , for , and .
se – doubleOutput
contains an estimate of the standard error of the corresponding element in parlag
qq – doubleOutput
On exit: contains an estimate of the th element of the residual variance-covariance matrix, , for , and .
x[m] – doubleOutput
On exit: contains , the likelihood ratio statistic at lag , for .
pvalue[m] – doubleOutput
contains the significance level of the statistic in the corresponding element of x
loglhd[m] – doubleOutput
On exit: contains an estimate of the maximum of the log-likelihood function when an model has been fitted to the series, for .
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
The recursive equations used to compute the partial autoregression matrices are ill-conditioned. They have been computed up to lag .
Dynamic memory allocation failed.
On entry, argument had an illegal value.
On entry, .
On entry, .
On entry, .
On entry, , and .
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG
The computations are believed to be stable.
8 Parallelism and Performance
nag_tsa_multi_part_regsn (g13dpc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_tsa_multi_part_regsn (g13dpc) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the Users' Note
for your implementation for any additional implementation-specific information.
The time taken is roughly proportional to .
For each order of autoregressive model that has been estimated, nag_tsa_multi_part_regsn (g13dpc) 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 for which is smallest. You should be warned that this does not always lead to the same choice of as indicated by the sample partial autoregression matrices and the likelihood ratio statistics.
This example computes the sample partial autoregression matrices of two time series of length up to lag .
10.1 Program Text
Program Text (g13dpce.c)
10.2 Program Data
Program Data (g13dpce.d)
10.3 Program Results
Program Results (g13dpce.r)