g13asc is a diagnostic checking function suitable for use after fitting a Box–Jenkins ARMA model to a univariate time series using g13bec. The residual autocorrelation function is returned along with an estimate of its asymptotic standard errors and correlations. Also, g13asc calculates the Box–Ljung portmanteau statistic and its significance level for testing model adequacy.
The function may be called by the names: g13asc, nag_tsa_uni_arima_resid or nag_tsa_resid_corr.
3Description
Consider the univariate multiplicative autoregressive-moving average model
(1)
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 g13asc.)
4References
Box G E P and Ljung G M (1978) On a measure of lack of fit in time series models Biometrika65 297–303
McLeod A I (1978) On the distribution of the residual autocorrelations in Box–Jenkins models J. Roy. Statist. Soc. Ser. B40 296–302
5Arguments
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.
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 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
NE_2_INT_ARG_LT
On entry, while . These arguments must satisfy .
NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_ARIMA_INPUT
On entry, , , , , , and .
Constraints on the members of arimav are:
,
,
,
, , , if , then and .
NE_G13AS_AR
On entry, the autoregressive (or moving average) arguments are extremely close to or outside the stationarity (or invertibility) region. To proceed, you must supply different parameter estimates in the array par.
NE_G13AS_DIAG
This is an unlikely exit. At least one of the diagonal elements of rc was found to be either negative or zero. In this case all off-diagonal elements of rc are returned as zero and all diagonal elements of rc set to .
NE_G13AS_FACT
On entry, one or more of the AR operators has a factor in common with one or more of the MA operators. To proceed, this common factor must be deleted from the model. In this case, the off-diagonal elements of rc are returned as zero and the diagonal elements set to . All other output quantities will be correct.
NE_G13AS_ITER
This is an unlikely exit brought about by an excessive number of iterations being needed to evaluate the zeros of the AR or MA polynomials. All output arguments are undefined.
NE_G13AS_ZERO_VAR
On entry, the residuals are practically identical giving zero (or near zero) variance. In this case chi is set to zero, siglev to one and all the elements of r set to zero.
NE_INPUT_NARMA
On entry, , , , while .
Constraint: .
NE_INT_3
On entry, , , .
Constraint: .
NE_INT_ARG_LT
On entry, .
Constraint: .
NE_INTERNAL_ERROR
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 for assistance.
7Accuracy
The computations are believed to be stable.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
g13asc is not threaded in any implementation.
9Further Comments
9.1Timing
The time taken by g13asc depends upon the number of residual autocorrelations to be computed, .
9.2Choice of
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 .
9.3Approximate Standard Errors
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.
10Example
A program to fit an ARIMA model to a series of observations. residual autocorrelations are computed.