Learn R Programming

aTSA (version 3.1.2.1)

ts.diag: Diagnostics for ARIMA fits

Description

Performs diagnostics for ARIMA model fitted by arima or estimate with output of diagnostic plots.

Usage

ts.diag(object, lag.seq = NULL)

Value

A matrix for the result of white noise checking by Ljung-Box test.

Arguments

object

the result of an arima or estimate fit.

lag.seq

the sequence of lag to calculate the Ljung-Box test statistics. The default is NULL.

Author

Debin Qiu

Details

This function is similar to ts.diag in stats package, but with one more diagnostic plot for the normality of residuals. Also, the default sequence of lags for a Ljung-Box test is set to be seq(4,24,by = 4) if sample size \(n > 24\), otherwise seq(1,n,4). This function has been automatically implemented in estimate function.

Diagnostics are plotted, including the ACF plot, PACF plot, p.value of white noise checking plot, and Q-Q plot for residuals.

Examples

Run this code
x <- arima.sim(list(order = c(3,0,0),ar = c(0.2,0.4,-0.15)),n = 100)
fit <- estimate(x,p = 3) # same as fit <- arima(x,order = c(3,0,0))
ts.diag(fit)

Run the code above in your browser using DataLab