of n depends on the number of lags of the error term (p). Software In R, this test is performed by function bgtest, available in package lmtest. In Stata, this test is performed by the command estat bgodfrey. In SAS, the GODFREY option of the MODEL statement in PROC AUTOREG provides a version of this test. In Python Statsmodels, the acorr_breusch_godfrey function in the module statsmodels.stats.diagnostic In EViews, this test is already done after a regression, at "View" → "Residual Diagnostics" → "Serial Correlation LM Test". In Julia, the BreuschGodfreyTest function is available in the HypothesisTests package. In gretl, this test can be obtained via the modtest command, or under the "Test" → "Autocorrelation" menu entry in the GUI client. See also Breusch–Pagan test Durbin–Watson test Ljung–Box test Autoregressive-moving-average model References Further reading Statistical tests Regression diagnostics Regression with time series structure