Compute Diagnostics for ARIMA Model

DESCRIPTION:

Computes diagnostics for an ARIMA model. The diagnostics include the autocorrelation function of the residuals, the standardized residuals, and the portmanteau goodness of fit test statistic.

USAGE:

arima.diag(z, acf.resid=T, gof.lag=10, lag.max=<<see below>>, resid=F,  
           std.resid=T, plot=T, type="h",...) 

REQUIRED ARGUMENTS:

z
a list like the output from arima.mle.

OPTIONAL ARGUMENTS:

acf.resid
logical flag: if TRUE, the autocorrelation of the residuals will be returned.
lag.max
the maximum number of lags at which to estimate the autocovariance. If this is not supplied, it is the maximum between gof.lag plus the number of model parameters and a number proportional to the logarithm of the length of the series.
gof.lag
if gof.lag>0, then gof.lag plus the number of model parameters is the number of lags to use for computing the Portmanteau goodness of fit statistic. If gof.lag=0, then the statistic will not be computed
resid
logical flag: if TRUE, then the residuals will be returned.
std.resid
logical flag: if TRUE, then the standardized residuals will be returned.
plot
logical flag: if TRUE, the diagnostics will be plotted using the function arima.diag.plot.
type
a character string giving the type of residual plot. The default is "h"; "l" and "p" are other valid choices.
...
additional arguments may be passed to the function arima.diag.plot.

VALUE:

a list (which is returned invisibly when plot=TRUE) with the following elements:
acf.list
a list representing the autocorrelation function of the residuals. See acf for details.
gof
a list representing the Portmanteau goodness of fit statistics computed for a range of lags. The list has four elements: lag, statistic, df, p.value. lag is a vector of the number of lags used to compute the statistics. statistic is the vector of statistics corresponding to each lag used. df is the number of degrees of freedom the test statistics have under the null hypothesis that the model is correct. p.value is a vector of the p-values for the statistics using a Chi-Squared distribution with the appropriate degrees of freedom.
resid
the residuals or innovations for the process.
std.resid
the standardized residuals. The residuals are standardized to have unit variance under the assumption that the model is correct and the process is Gaussian.
series
the name of x, including transformations.

SIDE EFFECTS:

if plot is TRUE, the diagnostics will be plotted using the function arima.diag.plot

DETAILS:

The residuals (both standardized and raw) are computed using the function arima.filt. The autocorrelation function of the residuals is computed using the function acf. The portmanteau test statistic is derived from the autocorrelation function of the residuals (see the chapter "Analyzing Time Series" of the S-PLUS Guide to Statistical and Mathematical Analysis for details).

REFERENCES:

Box, G. E. P. and Jenkins, G. M. (1976). Time Series Analysis: Forecasting and Control. Holden-Day, Oakland, Calif. Chapter 8.

The chapter "Analyzing Time Series" of the S-PLUS Guide to Statistical and Mathematical Analysis.

SEE ALSO:

, , .

EXAMPLES:

# compute and plot diagnostics for simulated AR(1) series with mean 5 
x <- arima.sim(model=list(ar=.9)) + 5 
xreg <- rep(1,100) 
fit <- arima.mle(x,model=list(ar=.9), xreg=xreg) 
diag <- arima.diag(fit) 
lynx.arma11 <- arima.mle(lynx, model=list(ar=0, ma=0)) 
arima.diag(lynx.arma11)