An ABA Breusch Godfrey test calculator checks whether residuals from one documented regression retain linear serial correlation through a prespecified lag order. It fits an auxiliary regression containing the original model columns and lagged residuals, then summarizes how much residual variation those added lags explain. The result is a model diagnostic, not proof of independence, and is not a treatment-effect estimate or a substitute for direct visual analysis.

Clinicians & ABA Professionals / Data, Outcomes and Clinical Decision-Making.

The question begins after a model is fitted

Breusch-Godfrey does not test the raw observations in isolation. It begins with residuals from a specific fitted model. Change the response, time coding, phase columns, trends, interactions, row set, weights, transformations, or missing-data treatment and the residuals change. The diagnostic must therefore travel with a complete model record.

Serial correlation means that residuals retain ordered dependence after accounting for the modeled predictors. That may point to omitted temporal structure, misspecified phase or trend terms, measurement cycles, changing opportunity, or another dependency. It can also reflect an unsuitable row unit or time spacing. The statistic alone does not identify the cause.

This page mirrors the current statsmodels implementation for its worked example. For a chosen highest lag q, the implementation prepends zeros for unavailable lagged residual positions, retains the original n rows, and regresses the full-model residuals on the original design plus residual lags 1...q. Other software can drop leading rows or use a different fill convention. Match conventions before comparing numbers.

Record the ordered analysis before testing

Use the worksheet only after these items are frozen. A reproducible ABA Breusch Godfrey test calculator needs this record; a p-value without it is not a reproducible result.

Required itemRecord before calculationStop or escalate whenIntended useExploratory diagnostic or prespecified inferential reviewThe test will decide treatment by itselfRow unitSession, day, interval, client, site, or another unitMultiple units are pooled as one ordered seriesTime keyStable order and actual spacingTies, gaps or reordered rows are unexplainedResponseOperational definition, unit and observation windowDefinitions or opportunities change without codingOriginal designEvery column, intercept rule and coding versionThe residual-producing model cannot be reconstructedLag order qHighest lag and rationale chosen in advanceLags were searched until a preferred result appearedBoundary conventionZero fill, row drop or another documented ruleSoftware defaults differ and are not reconciledMissing dataExclusion or imputation ruleGaps are compressed into equal steps silentlySoftware recordPackage, version, result fields and precisionOnly a rounded summary remainsReview thresholdAlpha and multiplicity plan, if applicableAlpha was chosen after seeing the p-value

The lag order should reflect the clinical and sampling question. A lag of one may represent one session only when adjacent rows are comparable sessions. If intervals are irregular, the row lag is not automatically a constant time lag.

Auxiliary regression and LM calculation

Let the original design matrix be X, the response be y, and the ordinary least-squares residual vector be e. For the stated statsmodels-style convention and highest lag q, construct columns L_k so that:

Lk,t = e(t-k) when t > k, otherwise 0

Fit the auxiliary regression:

et = Xt gamma + sum(k=1)^q rhok Lk,t + vt

Record the auxiliary coefficient estimates, fitted values, residuals, SSE, total centered sum of squares and R-squared. Then compute:

LM = n * R_aux^2

For the classical asymptotic reference used here:

pLM = P(ChiSquareq >= LM)

The current statsmodels Breusch-Godfrey documentation returns the LM statistic and p-value plus an alternative F statistic and p-value. Its note explains that residual lags are added to the original exogenous design. The current implementation source shows the zero-prefix lag construction, auxiliary OLS and n * R-squared calculation used in this example.

The F result is an alternative restriction test from the same auxiliary regression. Record it when software supplies it, but do not silently substitute it for the LM result. Small samples, rank problems and model assumptions can affect calibration. Qualified statistical review is required before inferential use.

Blank Breusch-Godfrey worksheet

First preserve the original fit.

Row keyTime or orderResponseOriginal fitted valueResidual e_tOriginal design columnsPhase or context

Then construct each lag explicitly.

Row keyResidual e_tLag 1Lag 2Additional lagsAuxiliary fitted valueAuxiliary residual

Summary itemRecorded valueRows nHighest lag qBoundary conventionAuxiliary SSEAuxiliary centered TSSAuxiliary R-squaredLM = n * R_aux^2Chi-square reference degrees of freedomLM survival probabilityAlternative F statistic and probabilitySoftware, version and precision

Keep signed residuals and lag columns. A single summary cannot reveal whether one transition, cycle, outlier or data-quality problem drives the result.

Fictional fourteen-row calculation

This arithmetic fixture is not an actual client, valid treatment analysis, or recommendation to model an ABA series with OLS. It uses an intercept, time 1...14, and a binary phase column that switches to 1 at row 8. The response values are synthetic.

RowTimePhaseResponseFull fittedResidualLag 1Lag 21105.04.98750000000.01250000000.00000000000.00000000002205.85.9250000000-0.12500000000.01250000000.00000000003307.16.86250000000.2375000000-0.12500000000.01250000004408.47.80000000000.60000000000.2375000000-0.12500000005508.78.7375000000-0.03750000000.60000000000.23750000006609.19.6750000000-0.5750000000-0.03750000000.600000000077010.510.6125000000-0.1125000000-0.5750000000-0.037500000088113.213.5017857143-0.3017857143-0.1125000000-0.575000000099114.814.43928571430.3607142857-0.3017857143-0.11250000001010115.115.3767857143-0.27678571430.3607142857-0.30178571431111115.916.3142857143-0.4142857143-0.27678571430.36071428571212117.317.25178571430.0482142857-0.4142857143-0.27678571431313118.918.18928571430.71071428570.0482142857-0.41428571431414119.019.1267857143-0.12678571430.71071428570.0482142857

The original coefficients are 4.0500000000, 0.9375000000, and 1.9517857143. With q=2, the auxiliary design contains those three original columns plus the two displayed lag columns. The auxiliary coefficients are -0.0671784237, 0.0364797388, -0.4813438700, 0.0512023167, and -0.8101003340.

The auxiliary SSE is 1.2262041115, and its R-squared is 0.3071594164. Therefore LM = 14 * 0.3071594164 = 4.3002318291. With two reference degrees of freedom, the chi-square survival probability is 0.1164706563.

That probability does not show that the residuals are independent. It says only that this statistic, under this documented model, ordering, lag, boundary and asymptotic reference, does not fall in the most extreme upper 5 percent of that reference distribution. A different prespecified alpha would change the label, not the underlying residual pattern.

One-value sensitivity comparison

Change only row 14's fictional response from 19.0 to 17.5, refit the original model, rebuild its residual lags and repeat the same q=2 calculation. Auxiliary R-squared becomes 0.4555111553, LM becomes 6.3771561746, and the two-degree-of-freedom survival probability becomes 0.0412304554.

The result moves across a conventional 0.05 line because one synthetic observation changed. This does not prove that 19.0 is an error, that 17.5 is preferable, or that either model captures the data-generating process. Preserve both calculations as sensitivity evidence and verify the source record before any correction.

Lag and boundary choices change the question

Increasing q adds residual-lag columns and changes both the auxiliary fit and reference degrees of freedom. It is not a free search for significance. Choose lags from the measurement schedule, a plausible temporal mechanism and the analysis plan. If several lag orders are examined, preserve all results and address multiplicity and selection with qualified review.

Boundary handling matters. The current CRAN lmtest manual documents bgtest options including lag order and fill behavior. A program that omits early rows can produce a different result from the zero-prefix convention here. Neither should be called an independent replication until rows, lag columns and reference calculations agree.

Response translation with an intercept preserves OLS residuals and therefore preserves this calculation. Multiplying the response by a nonzero constant scales residuals and both sides of the auxiliary regression but preserves its R-squared and LM statistic, subject to numerical tolerance. Arbitrarily permuting row order changes lag columns and therefore changes the diagnostic question.

Relationship to other residual checks

The statsmodels diagnostics index lists Breusch-Godfrey alongside Durbin-Watson and Ljung-Box. They are not interchangeable. Durbin-Watson has a focused adjacent-residual form. Ljung-Box summarizes residual autocorrelations through selected lags without adding the original regression columns in the same way. Breusch-Godfrey tests restrictions on lagged residual terms in an auxiliary regression that retains those original columns.

Read residual plots and autocorrelation values, not only a tail probability. The NIST regression-diagnostics guidance places residual run-sequence and lag plots inside a broader fit review. A test can have low power in a small sample, and a conspicuous residual pattern can still demand investigation when a selected statistic is not conventionally significant.

Heteroscedasticity, nonlinear trend, phase misfit, outliers and changing opportunity can distort a residual series. A serial-correlation result does not select the remedy. Robust covariance, generalized least squares, mixed models, interrupted time-series models or another approach each requires its own assumptions and qualified review.

Stop conditions and investigation path

Stop when time order is missing, intervals are not comparable, repeated clients are interleaved as one series, residuals do not come from the recorded model, the auxiliary design is rank deficient, or the remaining degrees of freedom are inadequate. Also stop if later outcomes helped construct predictors for earlier rows. That leakage cannot be cured by a residual test.

Inspect raw data provenance, opportunity and denominator changes, phase boundaries, setting events, staffing, treatment integrity, measurement drift, schedule gaps and data-entry corrections. Review the original fitted values and signed residuals. Preserve the direct graph, residual run-sequence plot, lag plot and any prespecified sensitivity fits.

Do not delete a row, add a lag, change a phase boundary or recode time merely to obtain a preferred probability. If a verified correction is necessary, retain the original result, corrected result, date, author and rationale. If the analysis influences service decisions, ensure that clinical meaning and client priorities remain visible.

Clinical and ethical boundaries

Breusch-Godfrey cannot establish treatment effect, experimental control, functional relation, causation, social validity or clinical importance. Phase-structured single-case data require design logic and visual analysis that a regression residual test cannot create. A high p-value is not proof that observations are independent; a low p-value is not proof that treatment failed.

The BACB Ethics Code materials frame professional competence and data-based practice. The BCBA Test Content Outline separately covers measurement, graphing, interpretation and experimental design. The Standards for Educational and Psychological Testing emphasize intended use and supporting evidence. These sources neither require a Breusch-Godfrey test nor validate this fictional calculation.

A statistician or time-series specialist should review lag choice, boundary convention, model form, degrees of freedom and inferential use. The responsible clinician should review measurement, phase logic, treatment integrity and client significance. Clients and caregivers should be included when an analysis could shape goals or services. External clinical and methods review remains pending.

Privacy, security and accessible implementation

Use authorized, de-identified row keys in the worksheet. Store any re-identification key separately in an approved system, and apply the organization's access, retention and audit safeguards. Federal context for covered entities and business associates is available in the HHS Privacy Rule summary and HHS Security Rule summary. Those summaries do not determine every organization's obligations.

Do not paste protected data into an unapproved web calculator. Save the model specification, row order, residuals, lag matrix, software version and output together in an authorized location. An accessible tool should label every field, explain errors in text, support keyboard use, preserve visible focus, offer a plain-language interpretation, and avoid conveying probability or stop conditions by color alone.

Related resources

Sources