breuschGodfrey: Breusch-Godfrey Statistic

Description Usage Arguments Details Value Author(s)

View source: R/functions.R


Modified Breusch-Godfrey Statistic \frac{n * R^2}{n}.


breuschGodfrey(y, x, order = FALSE, fill = 0)



A numeric vector.


A numeric vector.


Order to which residuals are lagged. Defaults to order <- (n - k - 1), where n is the number of observations, and k is the number of parameters in the regression (2 by default). This represents the highest possible order given n.


Defaults to fill = 0, used to fill model matrix for lagged residuals in the auxiliary regression.


NOTE: This function is a (very slightly) modified version of bgtest from the lmtest package (available at We have stripped it down to minimal functionality for our purposes. All development credit goes to the authors of lmtest.

This function is a dependency for rankLocReg where it is used to calculate bgN (Breusch-Godfrey Statistic) divided by the number of observations \frac{n * R^2}{n}. For the purposes of rankLocReg, only the relative variance explained by the fitted values from the auxiliary regression and the residuals of the original regression is of interest. Calculating \frac{n * R^2}{n} preserves this information, while avoiding the introduction of strong covariance between bgN and n; an undesirable behaviour for the linearity metric L. If desired, users can reproduce a standard Breusch-Godfrey Chi-squared test of significance by running qchisq with the output bgN and df. However, we would recommend using the function bgtest from the package lmtest, as it is specifically designed for this purpose.


A list with: the standard BG statistic (bg), BG/n (bgN), and d.f. (df).


Colin Olito.

colin-olito/LoLinR documentation built on May 13, 2019, 9:54 p.m.