What Counts as Residual Batch Signal?
Batch adjustment aims to reduce unwanted technical differences among samples while retaining biological variation of interest. A useful diagnostic question is whether the adjusted measurements still vary systematically with batch. But a remaining association is not, by itself, proof of under-correction: biological composition may also differ across batches, and the adjustment procedure may have been designed to preserve that biology.
Let \(Y_{ig}\) denote the measured value for sample \(i\) and feature \(g\), \(B_i\) its batch, and \(C_i\) the biological covariates to preserve, such as disease status or cohort. Write \(Y^{\mathrm{adj}}_{ig}\) for the value output by the adjustment procedure. A residual batch association is a systematic difference in \(Y^{\mathrm{adj}}_{ig}\) across values of \(B_i\), considered in the context of \(C_i\). The relevant association might be a mean contrast, a variance difference, or a multivariate pattern; the diagnostic must match the suspected residual structure.
A common feature-level diagnostic is to compare adjusted means across two batches within biological groups. For two batches, define the conditional contrast for group \(c\) as
When biological groups are adequately represented in both batches, a nonzero \(\Delta_{gc}\) indicates that adjusted values still differ by batch within that group. Whether the difference is technically unwanted still requires evidence about the design, controls, and measurement process.
Assumptions and a Diagnostic Justification
For a simple inferential check, consider the model
Here \(C_i\) and \(B_i\) encode biological covariates and batch indicators, respectively. The coefficient vector \(\gamma_g\) describes the conditional batch association for feature \(g\). Testing \(H_0:\gamma_g=0\) asks whether the adjusted values retain a linear batch association conditional on the included biological covariates. For the usual small-sample \(t\)- or \(F\)-based inference, the model needs a correctly specified conditional mean, independent errors at the observational-unit level, and errors with constant variance and an appropriate normal distribution; large-sample approximations can relax normality. The design matrix must also contain enough overlap to distinguish batch from the biological covariates.
A short derivation clarifies what the conditional comparison estimates. For a single batch indicator vector \(b\), let \(X\) contain the intercept and biological covariates, and let \(M_X=I-X(X^\mathsf{T}X)^{-1}X^\mathsf{T}\) remove their linear contributions. If \(X\) has full column rank and the model is \(y=X\theta+b\gamma+\varepsilon\), the partial regression estimate is
Substituting the model gives \(M_Xy=M_Xb\gamma+M_X\varepsilon\), because \(M_XX=0\). Therefore,
If the errors have conditional mean zero and \(b^\mathsf{T}M_Xb>0\), then \(E(\hat{\gamma}\mid X,b)=\gamma\). The final condition fails when batch is perfectly determined by the biological covariates: there is no within-covariate batch information from which to estimate a separate batch effect.
There is an important diagnostic trap. If an ordinary least-squares adjustment fits batch and then reports its fitted residuals from the same model, those residuals are orthogonal to the fitted batch indicators by construction. Testing those same residuals for the same linear batch effect will not reveal under-correction. Diagnostics must examine the actual adjusted output using information not mechanically constrained to have zero association—for example, independent reference samples, negative controls, technical replicates, or residual structures not forced away by the fitted adjustment. A PCA plot of adjusted data can be informative descriptively, but it does not replace a design-aware comparison.
Worked Example: A Remaining Adjusted Mean Difference
Suppose a hypothetical adjustment produces feature values in arbitrary normalized intensity units for 20 samples in each of two batches. The adjusted mean is 0.30 units in batch 2 and 0.05 units in batch 1; the respective sample standard deviations are 0.40 and 0.35 units. Assume the samples are independent, the feature is approximately normal within each batch, and the comparison is not being interpreted as causal.
The estimated batch contrast is \(0.30-0.05=0.25\) intensity units. Using the Welch standard error,
Thus \(t=0.25/0.1189=2.103\). The Welch degrees of freedom are approximately
A two-sided \(t\)-test gives \(p\approx0.042\). Under the stated sampling and model assumptions, this is evidence against equal adjusted means for this feature in these two batches. The estimated difference is 0.25 intensity units; the result does not establish that the difference is technical. If many features are screened, the multiplicity of those tests must also be addressed before making feature-level claims.
Distinguishing Technical Residue From Biology
The distinction depends on what comparisons the design supports. If each biological group occurs in both batches, compare batches within group, or fit a model that conditions on the group. If batch and biology are aligned, an overall batch contrast mixes their differences. When they are perfectly confounded, no statistical adjustment can identify separate batch and biological effects from those observations alone.
Independent technical evidence can help interpret a residual pattern. Negative-control features expected not to respond to the biology of interest can indicate remaining technical shifts. Technical replicates measured across batches can reveal whether nominally identical material retains a batch difference. Bridge samples and reference materials can provide comparisons across platforms or cohorts. These sources strengthen or weaken a technical explanation, but none makes a poorly supported design identifiable.
Worked Example: A Crossed Design and Negative Controls
In a hypothetical study, disease groups A and B are each measured in both batches, with 32 samples in every batch-by-group cell. For a target feature, adjusted means are 0.00 units for group A in batch 1 and 0.10 in batch 2; for group B they are 1.00 in batch 1 and 1.10 in batch 2. Assume a common within-cell standard deviation of 0.20 units and independent samples.
The within-group batch contrasts are \(0.10-0.00=0.10\) units for group A and \(1.10-1.00=0.10\) units for group B. Each contrast has standard error
Each within-group \(t\)-statistic is \(0.10/0.0500=2.00\), with approximately 62 degrees of freedom under the equal-variance model. The two-sided \(p\)-value is about 0.050. The two group contrasts agree in direction and size, which is more informative than an unadjusted comparison of all samples, but the evidence from this feature alone remains limited.
Now suppose a prespecified panel of negative-control features has an average residual batch contrast of 0.08 units, with standard error 0.02 units. Its summary statistic is \(0.08/0.02=4.00\), giving strong evidence of a remaining batch-associated pattern among those controls under the model used for that summary. Because the controls are not expected to reflect the disease biology, this pattern supports a technical explanation for at least some residual signal. It does not prove that every target-feature difference is technical; controls and target features can respond differently to measurement processes.
Worked Example: Perfect Confounding Prevents Attribution
Suppose a hypothetical data set has 10 samples from cohort A, all measured in batch 1, and 10 from cohort B, all measured in batch 2. An adjusted feature has mean 1.0 units in cohort A and 3.0 units in cohort B, with a standard deviation of 0.5 units in each cohort. Assume independent, approximately normal observations. The observed contrast is \(3.0-1.0=2.0\) units, and its standard error is
The two-sample statistic is \(t=2.0/0.2236=8.944\), with 18 degrees of freedom under the equal-variance model, so the two-sided \(p\)-value is less than 0.001. The data provide strong evidence of a difference between the observed groups. They do not establish whether it is a cohort difference, a batch difference, or a combination: cohort and batch are perfectly aligned.
In the conditional model, the cohort indicator and batch indicator are identical, so the design matrix is rank deficient. There is no unique pair of cohort and batch coefficients. The small \(p\)-value for the observed group contrast cannot repair that lack of identification. A crossed design, bridge samples, or external technical information would be needed to separate the explanations.
Diagnostics, Alternatives, and Limitations
A practical assessment combines several views rather than relying on one test. Examine adjusted feature-level contrasts conditional on the biological groups that are represented across batches. Inspect multivariate summaries, such as PCA scores colored by batch, for broad remaining structure. Evaluate negative controls and technical replicates where available. Check that sample labels, batch assignments, and the adjustment output are correct before interpreting a pattern.
The methods answer different questions:
| Diagnostic | What it can indicate | Important limitation |
|---|---|---|
| Conditional mean contrast or regression coefficient | Feature-level adjusted association with batch | Depends on overlap and model assumptions; association does not identify cause |
| PCA of adjusted measurements | Broad multivariate grouping that may track batch | Visual separation is descriptive and can reflect biology or other structure |
| Negative-control features | Residual shifts in features not expected to reflect the target biology | Controls may not share the behavior of all target features |
| Technical replicates or bridge samples | Differences for comparable material processed across batches | Conclusions depend on how well the reference material represents study samples |
A failure to detect residual association is not proof that batch has been removed. A diagnostic may have low power, and some technical effects may be feature-specific or nonlinear. Conversely, declaring under-correction whenever any feature has a small \(p\)-value can produce misleading conclusions when many features are tested. Consider effect sizes, uncertainty, the number of features examined, and whether the pattern is replicated in relevant controls. A correction should not be intensified automatically: doing so could remove real biology, the central risk of overcorrection.
The most important limitation is identifiability. When batches contain different biological compositions, conditional comparisons require overlap; when there is no overlap, observational measurements alone cannot determine which aligned difference is technical. In partial confounding, estimates may be possible but uncertain, so the uncertainty and design limitations must remain part of the interpretation.
Common Mistakes
- Equating association with cause. A significant adjusted batch coefficient means adjusted values remain associated with batch conditional on the model covariates; it does not prove that the association is technical.
- Testing an OLS residual against the same fitted batch term. The residual is orthogonal to that term by construction. Use a diagnostic not mechanically constrained by the adjustment, or independent validation information.
- Ignoring biological overlap. If biological groups are unevenly distributed across batches, a pooled contrast can combine biology and technical effects. Compare within represented groups or acknowledge non-identifiability.
- Treating a nonsignificant result as proof of successful correction. A nonsignificant test can reflect low power or a diagnostic that does not capture the remaining pattern.
Check Your Understanding
Answer each question, then compare with the solutions.
- An adjusted feature has mean 2.4 units in batch 2 and 2.0 units in batch 1. What is the estimated batch contrast, and what can it establish?
- Why can an ordinary least-squares residual from a model containing batch fail as a diagnostic for that same linear batch effect?
- In a crossed design, a batch contrast is 0.12 units with \(SE=0.04\) units. Calculate the test statistic and state what it says.
- Every sample from one cohort is in batch 1, and every sample from a second cohort is in batch 2. Can the observed difference be uniquely attributed to batch?
- Name two sources of evidence that can help assess whether residual association is technical, and give one limitation of that evidence.
Solutions. (1) The contrast is \(2.4-2.0=0.4\) units, batch 2 minus batch 1. It establishes an observed adjusted difference; without design and control evidence, it does not establish a technical cause. (2) Least-squares residuals are orthogonal to the fitted batch indicator, so the same linear association is removed by construction. (3) \(t=0.12/0.04=3.00\). This is evidence of a nonzero conditional batch association under the model assumptions, not proof of under-correction. (4) No. Cohort and batch are perfectly confounded, so the two explanations are not separately identifiable from those data. (5) Examples include negative controls, technical replicates, and bridge samples. Negative controls may not behave like every target feature; replicates or bridges may not represent all study samples.