bg: Breusch-Godfrey test [BG test]

bgR Documentation

Breusch-Godfrey test [BG test]

Description

BG test is used to test for autocorrelation in the errors of a regression model

Usage

bg(
  model,
  order = 1,
  order.by = NULL,
  type = c("Chisq", "F"),
  data = list(),
  fill = 0
)

Arguments

model

is a (generalized)linear regression model

order

integer. maximal order of serial correlation to be tested.

order.by

Either a vector z or a formula with a single explanatory variable like ~ z

type

the type of test statistic to be returned

data

an optional data frame containing the variables in the model

fill

starting values for the lagged residuals in the auxiliary regression. By default 0 but can also be set to NA.

References

Mitchel, D. and Zeileis, A. Published 2021-11-07. lmtest package

Examples

model <- lm(real_gdp ~ imp + exp + poil + eurkzt + tonia_rate, data = macroKZ)
bg(model)

AFR documentation built on Nov. 2, 2023, 6:09 p.m.