R: Check that residuals from a time series model look like white...

checkresiduals {forecast} | R Documentation

## Check that residuals from a time series model look like white noise

### Description

Produces a time plot of the residuals, the corresponding ACF, and a histogram. If the degrees of freedom for the model can be determined, the output from either a Breusch-Godfrey test or a Ljung-Box test is printed.

### Usage

    checkresiduals(object, lag, df=NULL, test, ...)

### Arguments

`object` | Either a time series model, a forecast object, or a time series (assumed to be residuals).
`lag` | Number of lags to use in the Ljung-Box or Breusch-Godfrey test. If missing, it is set to `max(10,df+3)` for non-seasonal data, and `max(2m, df+3)` for seasonal data, where `df` is the degrees of freedom of the model, and `m` is the seasonal period of the data.
`df` | Number of degrees of freedom for fitted model, required for the Ljung-Box or Breusch-Godfrey test. Ignored if the degrees of freedom can be extracted from `object`.
`test` | Test to use for serial correlation. By default, if `object` is of class `lm`, then `test="BG"`. Otherwise, `test="LB"`.
`...` | Other arguments are passed to `ggtsdisplay`.

### Value

None

### Author(s)

Rob J Hyndman

### See Also

`ggtsdisplay`, `Box.test`, `bgtest`

### Examples

    fit <- ets(WWWusage)
    checkresiduals(fit)

[Package forecast version 8.0 Index]