Breusch-Godfrey Test Calculator
Enter aligned Y and X rows plus a fixed lag to fit a one-predictor OLS model and calculate Breusch–Godfrey LM and joint F references. The page shows the zero-padded residual-lag auxiliary regression without calling the residuals autocorrelated, independent, acceptable or predictive.
Enter the fitted-model rows and lag
The engine fits Y = β0 + β1X + e, then regresses e on the original intercept and X plus residual lags 1 through q.
Choose one whole lag from 1 through 12. The page does not optimize lag selection.
Enter 20 to 500 finite response values without percent signs, one aligned value per row.
Enter one finite, nonconstant predictor value for every Y row. The page adds the intercept.
Residual-lag auxiliary regression
Entered Regression Specification Diagnostics 1.0.0.
On smaller screens, scroll horizontally to inspect the complete audit table.
| Row | Response Y | Predictor X | Base fitted | Base residual | Lagged residuals | Auxiliary fitted residual | Auxiliary residual |
|---|
How this Breusch–Godfrey test is calculated
The first stage is the same disclosed one-predictor OLS fit used across this batch. Response Y is regressed on an intercept and entered predictor X. Those original regressors remain in the auxiliary model; this is why Breusch–Godfrey requires more than a residual vector.
For each row, the engine appends base-residual lags one through the selected q. Missing pre-sample residual positions at the start are filled with zero, and all n observations remain in the auxiliary regression. The audit table labels every lag value so this boundary is visible.
The LM statistic equals n times the auxiliary R-squared and is shown with an asymptotic chi-square reference using q degrees of freedom. The joint F reference compares the restricted base-residual sum of squares with the unrestricted auxiliary residual sum of squares and tests the q lag coefficients together.
The lag can be any whole number from one through twelve, subject to positive auxiliary residual degrees of freedom and a nonsingular design. Version 1.0.0 never searches across lags or selects the one with the smallest probability.
Worked example from the audited fixture
The governed example uses 48 aligned rows and a declared lag of three, independently reproduced with statsmodels 0.14.6.
- The common base OLS fit has intercept 0.40445558, slope 0.86262914, R-squared 0.78135869 and residual sum of squares 3.47334755.
- The zero-padded three-lag auxiliary regression has R-squared 0.06019505, giving LM 2.88936260 and joint F 0.91805835. Their displayed upper-tail references are 0.40899971 and 0.44020188; no autocorrelation conclusion is attached.
Reproduce it: select “Load audited example” above. The governed engine retains full precision and rounds only the visible interface.
How to interpret the result
- Read the output as a conditional test of the selected residual-lag block after retaining the original base regressors. It is not a general model score.
- A small reference probability can indicate tension with the maintained no-serial-correlation null through q under the stated model. It does not identify the correct lag structure or repair.
- A larger reference probability is not proof that errors are independent. The test may have limited power, the selected q may miss another pattern, or the base equation may be misspecified.
- The result depends on row order. Sort observations chronologically before entry and preserve that sequence; sorting by price, response magnitude or residual size changes the tested lags.
- Breusch–Godfrey differs from Durbin–Watson because it retains original regressors and can test several residual lags jointly. It differs from Ljung–Box because it is based on an auxiliary regression conditional on the fitted model.
- Lag choice should come from the research design, data frequency and diagnostic plan, not from repeatedly calculating until one reference crosses a preferred cutoff.
Assumptions and limits
- Enter 20 to 500 aligned finite rows and a whole lag from one through twelve. X must vary, the base residual sum must be positive, and the auxiliary design must be nonsingular.
- The browser calculator fits only an intercept and one predictor. It cannot reproduce a richer original regression with several regressors, lagged dependent variables, weights or fixed effects.
- Chronology, timestamp spacing, missing periods, market closures, overlapping returns, stationarity, structural breaks and residual provenance are not verified.
- The zero-padding convention retains all rows; other software or research designs may drop the first q rows and therefore produce different finite-sample results.
- LM and F probabilities are conditional references, not universal thresholds. Multiple lag searches require separate multiplicity and selection controls.
- No autocorrelation state, independence certification, model-adequacy decision, predictive edge, forecast, strategy validation, grade, signal or recommendation is generated.
Which regression diagnostic answers which question?
These diagnostics are complementary rather than interchangeable. They use different auxiliary responses, added terms and maintained nulls. A reference probability only has meaning alongside its source model, entered rows, chosen lag or power, auxiliary design and data-selection process.
| Diagnostic | Primary question | Output reference | Declared specification | Requires original Y and X |
|---|---|---|---|---|
| White | Residual variance versus X and X² | LM χ²(2) plus auxiliary F | One predictor; generated square | No |
| Breusch–Pagan / Koenker | Residual variance versus declared predictor | LM χ²(1) plus auxiliary F | Residuals and variance predictor | No |
| Breusch–Godfrey | Residual levels versus own lags | LM χ²(q) plus joint F | Base Y, X and fixed lag q | Yes |
| Ramsey RESET | Added fitted-value powers | Joint F plus Wald χ² | Base Y, X and maximum power | Yes |
Frequently asked questions
- It fits entered Y on X, then regresses the base residuals on the original intercept and X plus residual lags one through the declared q.
- The aligned observation count is multiplied by auxiliary R-squared and compared with an asymptotic chi-square reference using q degrees of freedom.
- Breusch-Godfrey is a model-aware auxiliary-regression procedure, so the intercept and entered predictor remain beside the residual-lag block.
- Version 1.0.0 prepends zeros for unavailable pre-sample residuals and keeps all n rows, matching the governed statsmodels implementation convention.
- It tests the selected q residual-lag coefficients together by comparing the restricted base-residual sum of squares with the unrestricted auxiliary fit.
- No. It uses the entered whole lag from one through twelve exactly and performs no information-criterion, probability or multiple-testing search.
- No. Breusch-Godfrey retains the base regressors in an auxiliary model, while Ljung-Box combines sample residual autocorrelations through a declared lag.
- No. It generates no autocorrelation verdict, independence certification, model grade, predictive-edge claim, forecast, signal or recommendation.
Sources and methodology
- statsmodels — Breusch–Godfrey — Official documentation for the LM and F references returned from a fitted regression result.
- statsmodels — diagnostic source — Official implementation source documenting retained regressors, zero-padded residual lags and all-row fitting.
Version 1.0.0 was locked after the base regression, auxiliary statistics, degrees of freedom, reference probabilities, coefficients and worked examples were independently recomputed with statsmodels 0.14.6 and SciPy 1.13.1. The browser calculator performs local arithmetic and does not upload entered observations. Outputs remain conditional on the disclosed model and assumptions.
Continue the serial-correlation audit
Verify the source data before testing the regression
Reconcile the exact symbol, observation timestamps, timezone, sampling frequency, missing rows, spread, commission, financing, currency conversion, rollover adjustments and preprocessing before entering Y and X. Correct diagnostic arithmetic cannot repair a selected, misaligned, cost-inconsistent or otherwise misspecified source model.
Risk and affiliate disclosure: Leveraged forex and CFD trading can result in substantial losses. These are affiliate links, so ForexMT4Indicators.com may receive compensation if you register or trade through them, at no additional cost to you. Availability and terms vary by jurisdiction and broker entity.

