statsmodels.stats.diagnostic.acorr_breusch_godfrey#

statsmodels.stats.diagnostic.acorr_breusch_godfrey(res, nlags=None, store=False, *, result_object=None)[source]#

Breusch-Godfrey Lagrange Multiplier tests for residual autocorrelation

Parameters:
resRegressionResults

Estimation results for which the residuals are tested for serial correlation.

nlagsint, optional

Number of lags to include in the auxiliary regression. (nlags is highest lag).

storebool, default False

If store is true, then an additional class instance that contains intermediate results is returned.

result_objectbool, optional

Flag indicating whether to return the results as an LMTestResult NamedTuple instead of a plain tuple. When store=True the NamedTuple holds the same five elements as the legacy tuple, so it unpacks identically and is always returned, with no warning. When store=False the legacy four-element tuple is returned by default and a FutureWarning is issued.

Deprecated since version 0.15.0: In release 0.16.0 or after July 2027, whichever is later, the default will change to always return an LMTestResult. Set result_object=True to opt in now, or result_object=False to silence the warning and keep the current return type.

Returns:
LMTestResult

If result_object=True, a NamedTuple with fields lm, lmpval, fval, fpval, and res_store (res_store is None when not computed). See LMTestResult.

Otherwise (the deprecated default), a plain tuple made up of:
lmfloat

Lagrange multiplier test statistic.

lmpvalfloat

The p-value for Lagrange multiplier test.

fvalfloat

The value of the f statistic for F test, alternative version of the same test based on F test for the parameter restriction.

fpvalfloat

The pvalue for F test.

res_storeResultsStore

A class instance that holds intermediate results. Only returned if store=True.

Notes

BG adds lags of residual to exog in the design matrix for the auxiliary regression with residuals as endog. See [1], section 12.7.1.

References

[1]

Greene, W. H. Econometric Analysis. New Jersey. Prentice Hall; 5th edition. (2002).