naginterfaces.library.tsa.uni_arima_resid¶
- naginterfaces.library.tsa.uni_arima_resid(v, mr, m, par, ishow, io_manager=None)[source]¶
uni_arima_resid
is a diagnostic checking function suitable for use after fitting a Box–Jenkins ARMA model to a univariate time series usinguni_arima_estim()
oruni_arima_estim_easy()
. The residual autocorrelation function is returned along with an estimate of its asymptotic standard errors and correlations. Also,uni_arima_resid
calculates the Box–Ljung portmanteau statistic and its significance level for testing model adequacy.For full information please refer to the NAG Library document for g13as
https://www.nag.com/numeric/nl/nagdoc_29.3/flhtml/g13/g13asf.html
- Parameters
- vfloat, array-like, shape
must contain an estimate of , for .
If
uni_arima_resid
is used following a call touni_arima_estim()
then the actual argument must be as returned byuni_arima_estim()
.If
uni_arima_resid
is used following a call touni_arima_estim_easy()
then the actual argument must be as returned byuni_arima_estim_easy()
.- mrint, array-like, shape
The orders vector (, , , , , , ) as supplied to
uni_arima_estim()
oruni_arima_estim_easy()
.- mint
The value of , the number of residual autocorrelations to be computed. See Further Comments for advice on the value of .
- parfloat, array-like, shape
The parameter estimates in the order , , , only.
- ishowint
Must be nonzero if the residual autocorrelations, their standard errors and the portmanteau statistics are to be printed and zero otherwise.
These quantities are available also as output variables in , , , and .
- io_managerFileObjManager, optional
Manager for I/O in this routine.
- Returns
- rfloat, ndarray, shape
An estimate of the residual autocorrelation coefficient at lag , for . If = 3 on exit then all elements of are set to zero.
- rcmfloat, ndarray, shape
The estimated standard errors and correlations of the elements in the array . The correlation between and is returned as except that if then contains the standard error of . If on exit, >= 5, then all off-diagonal elements of are set to zero and all diagonal elements are set to .
- chifloat
The value of the portmanteau statistic, . If = 3 on exit then is returned as zero.
- idfint
The number of degrees of freedom of .
- siglevfloat
The significance level of based on degrees of freedom. If = 3 on exit, is returned as one.
- Raises
- NagValueError
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, .
Constraint: and .
- (errno )
On entry, and .
Constraint: and .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, the seasonal moving average operator is non-invertible.
- (errno )
On entry, the seasonal autoregressive operator is nonstationary.
- (errno )
On entry, the non-seasonal moving average operator is non-invertible.
- (errno )
On entry, the non-seasonal autoregressive operator is nonstationary.
- (errno )
Excessive iterations needed to find zeros of determinental polynomials.
- (errno )
On entry, one or more of the AR operators has a factor in common with one or more of the MA operators.
- (errno )
The matrix could not be computed because one of its diagonal elements was found to be non-positive.
- Warns
- NagAlgorithmicWarning
- (errno )
On entry, the elements of are nearly identical giving near-zero variance.
- Notes
In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.
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 Further Comments.) 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
uni_arima_resid
.)Note: for additive models with fixed parameter values (i.e., fitted by
multi_varma_estimate()
)multi_varma_diag()
should be used instead ofuni_arima_resid
.
- 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