nag_tsa_resid_corr (g13asc) is a diagnostic checking function suitable for use after fitting a Box–Jenkins ARMA model to a univariate time series using
nag_tsa_multi_inp_model_estim (g13bec). The residual autocorrelation function is returned along with an estimate of its asymptotic standard errors and correlations. Also, nag_tsa_resid_corr (g13asc) calculates the Box–Ljung portmanteau statistic and its significance level for testing model adequacy.
Consider the univariate multiplicative autoregressive-moving average model
where
, for
, denotes a time series and
, for
, is a residual series assumed to be Normally distributed with zero mean and variance
. The
's are also assumed to be uncorrelated. Here
is the overall mean term,
is the seasonal period and
is the backward shift operator such that
. The polynomials in
(1) are defined as follows:
is the non-seasonal autoregressive (AR) operator;
is the non-seasonal moving average (MA) operator;
is the seasonal AR operator; and
is the seasonal MA operator. The model
(1) is assumed to be stationary, that is the zeros of
and
are assumed to lie outside the unit circle. The model
(1) is also assumed to be invertible, that is the zeros of
and
are assumed to lie outside the unit circle. When both
and
are absent from the model, that is when
, then the model is said to be non-seasonal.
The estimated residual autocorrelation coefficient at lag
,
, is computed as:
where
denotes an estimate of the
th residual,
, and
. A portmanteau statistic,
, is calculated from the formula (see
Box and Ljung (1978)):
where
denotes the number of residual autocorrelations computed. (Advice on the choice of
is given in
Section 9.) Under the hypothesis of model adequacy,
has an asymptotic
distribution on
degrees of freedom. Let
then the variance-covariance matrix of
is given by:
The construction of the matrix
is discussed in
McLeod (1978). (Note that the mean,
, and the residual variance,
, play no part in calculating
and therefore are not required as input to nag_tsa_resid_corr (g13asc).)
Box G E P and Ljung G M (1978) On a measure of lack of fit in time series models Biometrika 65 297–303
McLeod A I (1978) On the distribution of the residual autocorrelations in Box–Jenkins models J. Roy. Statist. Soc. Ser. B 40 296–302
- 1:
– Nag_ArimaOrder *
-
Pointer to structure of type Nag_ArimaOrder with the following members:
- p – Integer
- d – IntegerInput
- q – IntegerInput
- bigp – IntegerInput
- bigd – IntegerInput
- bigq – IntegerInput
- s – IntegerInput
-
On entry: these seven members of
arimav must specify the orders vector
, respectively, of the ARIMA model for the output noise component.
, , and refer, respectively, to the number of autoregressive , moving average , seasonal autoregressive and seasonal moving average arguments.
, and refer, respectively, to the order of non-seasonal differencing, the order of seasonal differencing and the seasonal period.
Constraints:
-
,
,
,
,
,
- ,
- if , then and .
- 2:
– IntegerInput
-
On entry: the number of observations in the residual series, .
Constraint:
.
- 3:
– const doubleInput
-
On entry: must contain an estimate of , for .
Constraint:
v must contain at least two distinct elements.
- 4:
– IntegerInput
-
On entry: the value of
, the number of residual autocorrelations to be computed. See
Section 9 for advice on the value of
m.
Constraint:
.
- 5:
– const doubleInput
-
On entry: the parameter estimates in the order , , , only.
Constraint:
the elements in
par must satisfy the stationarity and invertibility conditions.
- 6:
– IntegerInput
-
On entry: the number of ARMA arguments, , , and arguments, i.e., .
Constraint:
.
- 7:
– doubleOutput
-
On exit: an estimate of the residual autocorrelation coefficient at lag
, for
. If
on exit then all elements of
r are set to zero.
- 8:
– doubleOutput
-
On exit: the estimated standard errors and correlations of the elements in the array
r. The correlation between
and
is returned as
except that if
then
contains the standard error of
. If on exit,
or
NE_G13AS_DIAG, then all off-diagonal elements of
rc are set to zero and all diagonal elements are set to
.
- 9:
– IntegerInput
-
On entry: the stride separating matrix column elements in the array
rc.
Constraint:
.
- 10:
– double *Output
-
On exit: the value of the portmanteau statistic,
. If
on exit then
chi is returned as zero.
- 11:
– Integer *Output
-
On exit: the number of degrees of freedom of
chi.
- 12:
– double *Output
-
On exit: the significance level of
chi based on
df degrees of freedom. If
on exit then
siglev is returned as one.
- 13:
– NagError *Input/Output
-
The NAG error argument (see
Section 2.7 in How to Use the NAG Library and its Documentation).
The computations are believed to be stable.
nag_tsa_resid_corr (g13asc) is not threaded in any implementation.
The time taken by nag_tsa_resid_corr (g13asc) depends upon the number of residual autocorrelations to be computed, .
The number of residual autocorrelations to be computed,
should be chosen to ensure that when the ARMA model
(1) is written as either an infinite order autoregressive process:
or as an infinite order moving average process:
then the two sequences
and
are such that
and
are approximately zero for
. An overestimate of
is therefore preferable to an under-estimate of
. In many instances the choice
will suffice. In practice, to be on the safe side, you should try setting
.
When
all the standard errors in
rc are set to
. This is the asymptotic standard error of
when all the autoregressive and moving average arguments are assumed to be known rather than estimated.
A program to fit an ARIMA(1,1,2) model to a series of 30 observations. 10 residual autocorrelations are computed.