Why Batch Adjustment Depends on the Design
A difference in observed cell-type abundance between conditions can reflect biology, technical batch differences, or both. Including batch in a donor-level model can adjust for a batch-associated shift, but it does not create information that the study design did not collect. In particular, if all donors in one condition were processed in one batch and all donors in the other condition in another batch, the data cannot distinguish a condition effect from a batch effect.
The key question is therefore not just whether batch is included in a formula. It is whether the condition effect is estimable after accounting for batch. This is determined by the design matrix, before any particular fitting algorithm or p-value is considered.
A Donor-Level Model With Batch Terms
Let \(y_i\) be a donor-level abundance response for donor \(i\), such as a suitable transformed abundance or log-ratio for a cell type. The response and its scale should be chosen to match the analysis; an ordinary linear model is not automatically appropriate for every bounded proportion. Let \(C_i\) indicate condition, with \(C_i=0\) for the reference condition and \(C_i=1\) for the comparison condition. For \(K\) batches, use \(K-1\) indicator variables \(B_{ik}\), taking one batch as the reference.
For the usual linear-model standard errors and tests, assume independent donors, a correctly specified conditional mean, and residuals with a common variance; exact small-sample t-based inference additionally assumes normally distributed residuals. The donor, not each sequenced cell, is the independent observational unit in this model. If the response distribution or variance structure makes these assumptions implausible, a model suited to that response and design is needed. The design-matrix question of whether \(\beta_C\) is estimable remains important regardless of the fitting method.
The coefficient is an adjusted association on the response scale. For example, if \(y_i\) is a log-ratio, \(\beta_C\) is a condition contrast in log-ratio units, not a percentage-point change in cell proportion. Batch adjustment does not by itself establish that condition caused the difference.
Worked Examples of Adjustment and Estimability
Worked Example: A Common Condition Contrast Across Two Batches
Suppose the donor-level response is measured in hypothetical abundance units. Batch A has one control donor with response 7 and one treated donor with response 8. Batch B has one control donor with response 8 and three treated donors with responses 12, 13, and 14. Both conditions occur in both batches, so their effects are not completely confounded.
The within-batch condition contrasts are \(8-7=1\) unit in A and \((12+13+14)/3-8=13-8=5\) units in B. The latter calculation uses the mean of the three treated donors, \(39/3=13\).
For this additive linear model with independent, equal-variance errors, the information from a batch-specific contrast is proportional to \(n_0n_1/(n_0+n_1)\), where \(n_0\) and \(n_1\) are the batch’s control and treated donor counts. Batch A contributes \(1\cdot1/(1+1)=0.5\); batch B contributes \(1\cdot3/(1+3)=0.75\). These are unnormalized information weights, not shares that sum to one. Thus the common condition coefficient is
This estimate is a weighted combination of the two within-batch contrasts, with normalized weights \(0.5/1.25=0.4\) for A and \(0.75/1.25=0.6\) for B. The unadjusted difference between all treated and all control donors is different: the treated mean is \(47/4=11.75\), the control mean is \(15/2=7.5\), and their difference is \(4.25\) units. That crude comparison mixes condition and batch composition; the adjusted coefficient compares conditions within batches under the common-effect model.
Worked Example: Complete Condition–Batch Confounding
Now suppose two control donors, with responses 7 and 8, are both in batch A, while two treated donors, with responses 12 and 13, are both in batch B. Let \(B_i=1\) for batch B and 0 for batch A. In every observation, \(C_i=B_i\). With an intercept, the relevant design-matrix columns are therefore identical:
The observed treated mean is \((12+13)/2=12.5\), the control mean is \((7+8)/2=7.5\), and the difference is 5 units. But the model’s fitted difference between these groups is \(\beta_C+\gamma_B\), not either coefficient separately. Any pair of coefficients with the same sum gives the same fitted values. Consequently, the data identify the combined difference of 5 units, but cannot identify a condition effect adjusted for batch.
Dropping one of the identical columns may let software return a coefficient, but that coefficient is then determined by the imposed parameterization, not by information in this design. No change of software or estimation method can recover the separate effects without additional design information or assumptions.
Worked Example: Checking Rank When Conditions Occur in Both Batches
Consider two batches and two conditions, with at least one donor in each of the four batch-condition combinations. Code batch A as the reference, so a row of the design matrix is \((1,C_i,B_i)\). Three possible rows, for an A control, an A treated donor, and a B control, are
The determinant of this square matrix is 1, so its three columns are linearly independent. The full design matrix, which also contains the B treated row \((1,1,1)\), has rank 3. The intercept, condition coefficient, and batch coefficient can therefore be separately estimated in this two-condition, two-batch additive model. This rank check establishes estimability; it does not establish that the additive mean model is scientifically adequate or that its standard errors are reliable.
Why Rank Determines Whether Adjustment Is Possible
Write the model in matrix form as \(y=X\beta+\varepsilon\), where each row of \(X\) contains the intercept, condition indicator, and batch indicators. A coefficient contrast is estimable when the data determine its value from the fitted mean vector \(X\beta\). If a nonzero vector \(v\) satisfies \(Xv=0\), then \(\beta\) and \(\beta+v\) produce the same fitted mean, since \(X(\beta+v)=X\beta\). Any coefficient contrast that changes along such an indistinguishable direction is not estimable.
For the condition coefficient, another useful explanation comes from removing the batch effects first. Let \(Z\) contain the intercept and batch indicators, and let \(\tilde C\) be the condition indicator after its linear projection onto the columns of \(Z\) has been subtracted. In a full-rank additive model, the condition coefficient can be written as
This is the ordinary least-squares coefficient obtained by relating the part of the response not explained by batch to the part of condition not explained by batch. The denominator is the remaining condition information. If condition is completely determined by batch, then \(\tilde C=0\), the denominator is zero, and the condition coefficient cannot be computed from the data. If \(\tilde C\) is nonzero but very small, the coefficient is technically estimable but can be imprecise and sensitive to small changes in the data.
Design Checks, Alternatives, and Failure Modes
Before fitting an abundance model, cross-tabulate condition by batch and inspect the design matrix. Confirm that the relevant conditions are represented within batches, and check the matrix rank or singular values. A condition-by-batch table can reveal empty cells immediately; rank checks also detect linear dependencies involving several indicators or covariates. Strong imbalance is not the same as complete confounding, but it can leave little within-batch information and produce large standard errors.
After fitting, examine residuals and influential donors, and compare the observed condition patterns across batches. Large residuals, marked variance differences, or systematic within-batch patterns may indicate that the assumed mean or variance model is inadequate. These checks cannot repair a rank-deficient design. Nor can apparently stable fitted values show that condition and batch have been separated: in a confounded design the fitted combined group difference may be stable while its attribution is unidentified.
| Approach | What it does | Key limitation |
|---|---|---|
| Fixed batch terms in a donor-level model | Estimates condition contrasts using within-batch information and adjusts for batch shifts. | Requires condition information not fully explained by batch; the additive version assumes a common condition contrast. |
| Separate within-batch analyses | Reports condition contrasts separately for batches where both conditions occur. | May be inefficient or difficult to summarize, especially with small samples; it also cannot provide a within-batch contrast where a condition is absent. |
| Random batch effects | Models batch variation as arising from a distribution, potentially partially pooling batch estimates. | Does not resolve complete confounding; separating condition from batch then relies on additional modeling assumptions rather than crossed comparisons. |
Including batch is not a substitute for balanced experimental allocation. The strongest protection is to process donors from each condition across batches, so the comparison is supported by within-batch evidence. If batch and condition are completely confounded, the defensible conclusion is that the condition-specific effect cannot be separated from batch in these data. A model may estimate their combined difference, but describing that result as batch-adjusted is not justified.
Common Mistakes
- Assuming a batch term guarantees adjustment. Adding a batch indicator to a formula does not make a confounded condition coefficient estimable. Check design overlap and rank.
- Interpreting a software output as proof of identification. A dropped column, reference constraint, or returned coefficient cannot supply information absent from the design.
- Using the pooled difference as the adjusted effect. When condition and batch counts differ, the pooled comparison can reflect different batch composition. Use the model appropriate to the design and state its assumptions.
- Treating near-confounding as harmless. A full-rank matrix can still yield weak condition information and an unstable estimate. Inspect standard errors and the amount of within-batch overlap.
- Calling an adjusted association causal. Adjustment for recorded batch does not control unmeasured confounding or prove that condition caused the abundance difference.
Check Your Understanding
Try each question, then compare your reasoning with the solutions below.
- In a two-condition study, each batch contains donors from both conditions. What does this overlap contribute to estimating a condition effect adjusted for batch?
- In batch A, the control mean is 4 and the treated mean is 6. In batch B, the control mean is 10 and the treated mean is 13. What are the two within-batch contrasts, and what common contrast results if the batches have equal information under an additive model?
- If every control donor is in batch A and every treated donor is in batch B, can a fixed-batch model separate the condition effect from the batch effect? Explain using the design matrix.
- Why can a nearly confounded design produce an imprecise condition estimate even when the design matrix has full rank?
Solutions. (1) It supplies within-batch comparisons, so condition is not entirely explained by batch; an adjusted condition contrast may be estimable, subject to the model assumptions. (2) The contrasts are \(6-4=2\) and \(13-10=3\) units. With equal information, the common contrast is \((2+3)/2=2.5\) units. (3) No. The condition and batch indicator columns are identical (or linearly dependent with the intercept and other indicators), so only their combined contribution is identified. (4) Near confounding leaves little condition variation after batch is accounted for, making the remaining information small and the estimate’s standard error large.