Regression Autocorrelation Diagnostics

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.

Original regressors retainedLag declared before calculationNo autocorrelation verdict

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.

Entered

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.

Breusch–Godfrey boundary: The selected lag is used exactly and early lag positions are zero-padded to retain all n rows, matching the governed statsmodels convention. The page does not choose a lag or verify time ordering.

Residual-lag auxiliary regression

Entered Regression Specification Diagnostics 1.0.0.

Derived
Enter aligned rows and a lagThe result will expose the base regression, residual-lag design, LM and joint F references and every fitted auxiliary residual.

How this Breusch–Godfrey test is calculated

LM = nR²aux, where et = γ0 + γ1Xt + Σj=1..qρjet−j + ut

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.

  1. The common base OLS fit has intercept 0.40445558, slope 0.86262914, R-squared 0.78135869 and residual sum of squares 3.47334755.
  2. 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.

Comparison of regression diagnostic questions and model requirements
DiagnosticPrimary questionOutput referenceDeclared specificationRequires original Y and X
WhiteResidual variance versus X and X²LM χ²(2) plus auxiliary FOne predictor; generated squareNo
Breusch–Pagan / KoenkerResidual variance versus declared predictorLM χ²(1) plus auxiliary FResiduals and variance predictorNo
Breusch–GodfreyResidual levels versus own lagsLM χ²(q) plus joint FBase Y, X and fixed lag qYes
Ramsey RESETAdded fitted-value powersJoint F plus Wald χ²Base Y, X and maximum powerYes

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

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.

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.

XM

Review applicable statements, symbol specifications and execution terms.

Check XM terms

FBS

Confirm account-history and trading-cost conventions for your region.

Check FBS terms

FXOpen

Verify statement, charge and execution records before deriving inputs.

Check FXOpen terms

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.

Disclaimer: The results from this tool are estimates for educational and informational purposes only and may differ from your broker's figures. This is not financial or investment advice. Trading forex and CFDs carries a high level of risk and can result in the loss of all your capital. Always verify calculations with your broker and trade within your risk tolerance.