Breusch-Godfrey Test
The Breusch-Godfrey Test of Breusch (1978) and Godfrey (1978) is a Lagrange multiplier test of autocorrelation up to any number of lags p, which stays valid when the regressors include lagged values of the dependent series. It regresses the residuals on the original regressors and their own lags and asks whether the lags explain them.
The formula for the Breusch-Godfrey Test regresses the OLS residuals on the regressors and p lagged residuals, with the residuals before the sample set to 0:
\[e_{t} = x'_{t} \cdot a + \sum_{j=1}^{p} \rho_{j} \cdot e_{t-j} + v_{t}\]The LM statistic is the number of observations times the R-squared of this auxiliary regression:
\[R^{2} = 1 - \frac{\text{SSR}}{\sum (e_{t} - \bar{e})^{2}}\] \[\text{LM} = n \cdot R^{2}\]Its F form compares the fit with and without the lagged residuals:
\[F = \frac{\frac{\text{SSR}_{0} - \text{SSR}}{p}}{\frac{\text{SSR}}{n - k - p}}\]Where \(e_{t}\) are the residuals of the regression, \(x_{t}\) the regressors, a and \(\rho_{j}\) the coefficients and \(v_{t}\) the error of the auxiliary regression, SSR its residual sum of squares, \(\text{SSR}_{0}\) that of the fit without the lags (the sum of \(e_{t}^{2}\) when the regression has a constant), n the number of observations and k the number of regressors. LM is chi-squared with p degrees of freedom and F is F(p, n - k - p) distributed under the null: no autocorrelation is rejected when the p-value is below the significance level (0.05 for the 5% level). The test says that the residuals are autocorrelated, not at which lag; with too few lags it misses autocorrelation at longer lags, and too many lags cost power.
OLS standard errors assume that the residuals of consecutive periods are uncorrelated. When they are autocorrelated, the coefficients stay unbiased but the standard errors are unreliable, usually too small, and positive autocorrelation in the residuals often signals an omitted trend or lagged effect. A test of autocorrelation asks whether the residuals are uncorrelated over time, the null hypothesis, or correlated with their own past, the alternative. A rejection calls for a HAC (heteroskedasticity and autocorrelation consistent) covariance or generalised least squares with autocorrelated errors.
Also known as: BG test, serial correlation LM test, Godfrey test.
In the Finance Toolkit this is get_durbin_watson_test with method="breusch_godfrey", the same function as Durbin-Watson Test.
Example · HD, LOW · 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_durbin_watson_test:
from financetoolkit import Toolkit
toolkit = Toolkit(
["HD", "LOW"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2025-01-01",
end_date="2025-12-31",
)
# HD (the first ticker) is dependent; LOW is independent
toolkit.econometrics.get_durbin_watson_test(method="breusch_godfrey")
| Parameter | Type | Description | Example |
|---|---|---|---|
dependent_ticker | str | None | The dependent (predicted) asset. Defaults to None, meaning the Toolkit instance’s first ticker. | "AAPL" |
independent_tickers | str | list[str] | None | The independent (predictor) asset(s). Defaults to None, meaning every other ticker in the Toolkit instance besides dependent_ticker. | ["MSFT", "Benchmark"] |
include_benchmark | bool | Whether to include “Benchmark” in the default independent ticker(s) (has no effect when independent_tickers is given explicitly). Defaults to False. | True |
period | str | The data frequency (daily, weekly, monthly, quarterly, or yearly). Defaults to “daily”. | "weekly" |
column | str | The historical data column to regress on. Defaults to “Return”. | "Return" |
add_constant | bool | Whether to include an intercept in the underlying regression. Defaults to True. | False |
rounding | int | None | The number of decimals to round the results to. Defaults to None. | 2 |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |
method | str | The test. Options are: “durbin_watson” (Durbin-Watson Test), “breusch_godfrey” (Breusch-Godfrey Test). Defaults to “durbin_watson”. | "durbin_watson" |
lags | int | The number of lagged residuals p of the Breusch-Godfrey test. Defaults to 1. | 2 |
Which returns:
| Item | 0 |
|---|---|
| Breusch-Godfrey LM Statistic | 1.245 |
| LM P-Value | 0.2645 |
| F-Statistic | 1.2362 |
| F P-Value | 0.2673 |
| Reject No Serial Correlation (5%) | 0 |
Using Your Own Data
get_durbin_watson_test runs on any data, not only prices: ratios, economic indicators, yield curves or your own dataset. Pass a DataFrame, a Series or a dictionary of them to Econometrics as data, with the dates in the rows or the columns, and set changes to how its changes are calculated: "percentage", "log", "difference" for rates and ratios, or None when the data are changes already. For example, for the monthly unemployment rates of the United States and Germany:
from financetoolkit import Economics, Econometrics
economics = Economics(start_date="2000-01-01")
unemployment = economics.get_unemployment_rate(
countries=["United States", "Germany"], period="monthly"
)
econometrics = Econometrics(data=unemployment, changes="difference")
econometrics.get_durbin_watson_test()
References
- Paper Breusch, T.S. (1978). “Testing for Autocorrelation in Dynamic Linear Models.” Australian Economic Papers, 17(31), 334-355.
- Paper Godfrey, L.G. (1978). “Testing Against General Autoregressive and Moving Average Error Models when the Regressors Include Lagged Dependent Variables.” Econometrica, 46(6), 1293-1301.
- Library Referenced against statsmodels’ acorr_breusch_godfrey (Breusch-Godfrey Test)