If plot = TRUE, produces a time plot of the residuals, the
corresponding ACF, and a histogram. If test is not FALSE,
the output from either a Ljung-Box test or Breusch-Godfrey test is printed.
checkresiduals(object, lag, test, plot = TRUE, ...)None
Either a time series model, a forecast object, or a time series (assumed to be residuals).
Number of lags to use in the Ljung-Box or Breusch-Godfrey test.
If missing, it is set to min(10, n/5) for non-seasonal data, and
min(2m, n/5) for seasonal data, where n is the length of the series,
and m is the seasonal period of the data. It is further constrained to be
at least df+3 where df is the degrees of freedom of the model. This
ensures there are at least 3 degrees of freedom used in the chi-squared test.
Test to use for serial correlation. By default, if object
is of class lm, then test = "BG". Otherwise, test = "LB".
Setting test = FALSE will prevent the test results being printed.
Logical. If TRUE, will produce the plot.
Other arguments are passed to ggtsdisplay().
Rob J Hyndman
ggtsdisplay(), stats::Box.test(), [lmtest::bgtest()
fit <- ets(WWWusage)
checkresiduals(fit)
Run the code above in your browser using DataLab