g13as is a diagnostic checking method suitable for use after fitting a Box–Jenkins ARMA model to a univariate time series using
(G13AEF not in this release) g13af.
The residual autocorrelation function is returned along with an estimate of its asymptotic standard errors and correlations. Also, g13as calculates the Box–Ljung portmanteau statistic and its significance level for testing model adequacy.
Syntax
C# |
---|
public static void g13as( int n, double[] v, int[] mr, int m, double[] par, int ishow, double[] r, double[,] rcm, out double chi, out int idf, out double siglev, out int ifail ) |
Visual Basic |
---|
Public Shared Sub g13as ( _ n As Integer, _ v As Double(), _ mr As Integer(), _ m As Integer, _ par As Double(), _ ishow As Integer, _ r As Double(), _ rcm As Double(,), _ <OutAttribute> ByRef chi As Double, _ <OutAttribute> ByRef idf As Integer, _ <OutAttribute> ByRef siglev As Double, _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void g13as( int n, array<double>^ v, array<int>^ mr, int m, array<double>^ par, int ishow, array<double>^ r, array<double,2>^ rcm, [OutAttribute] double% chi, [OutAttribute] int% idf, [OutAttribute] double% siglev, [OutAttribute] int% ifail ) |
F# |
---|
static member g13as : n : int * v : float[] * mr : int[] * m : int * par : float[] * ishow : int * r : float[] * rcm : float[,] * chi : float byref * idf : int byref * siglev : float byref * ifail : int byref -> unit |
Parameters
- n
- Type: System..::..Int32On entry: , the number of observations in the residual series.Constraint: .
- v
- Type: array<System..::..Double>[]()[][]An array of size [n]On entry: must contain an estimate of , for .Constraint: must contain at least two distinct elements.
- mr
- Type: array<System..::..Int32>[]()[][]An array of size []On entry: the orders vector (, , , , , , ) as supplied to (G13AEF not in this release) g13af.Constraints:
- ;
- ;
- if , then and .
- m
- Type: System..::..Int32On entry: the value of , the number of residual autocorrelations to be computed. See [Choice of ] for advice on the value of m.Constraint: .
- par
- Type: array<System..::..Double>[]()[][]An array of size [dim1]Note: dim1 must satisfy the constraint:On entry: the parameter estimates in the order , , , only.Constraint: the elements in par must satisfy the stationarity and invertibility conditions.
- ishow
- Type: System..::..Int32
- r
- Type: array<System..::..Double>[]()[][]An array of size [m]On exit: an estimate of the residual autocorrelation coefficient at lag , for . If on exit then all elements of r are set to zero.
- rcm
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, m]Note: dim1 must satisfy the constraint:
- chi
- Type: System..::..Double%On exit: the value of the portmanteau statistic, . If on exit then chi is returned as zero.
- idf
- Type: System..::..Int32%On exit: the number of degrees of freedom of chi.
- siglev
- Type: System..::..Double%
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
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.
(1) |
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)):
References
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
Error Indicators and Warnings
Note: g13as may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface
(NPAR, LDRCM) In these
cases, an error in another parameter has usually caused an incorrect value to be inferred.
- On entry, the autoregressive (or moving average) parameters are extremely close to or outside the stationarity (or invertibility) region. To proceed, you must supply different parameter estimates in the array par.
- 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 parameters are undefined.
- 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 rcm are returned as zero and the diagonal elements set to . All other output quantities will be correct.
Accuracy
The computations are believed to be stable.
Parallelism and Performance
None.
Further Comments
Timing
The time taken by g13as depends upon the number of residual autocorrelations to be computed, .
Choice 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 .
Approximate Standard Errors
When or all the standard errors in rcm are set to . This is the asymptotic standard error of when all the autoregressive and moving average parameters are assumed to be known rather than estimated.
Alternative Applications
Example
This example fits an ARIMA model to a series of observations. residual autocorrelations are computed.
Example program (C#): g13ase.cs