From a Batch Table to a Statistical Claim
A batch-condition table is not just a description of how cells were processed. It determines which comparisons the data can support. If every control sample was processed in one batch and every treated sample in another, an observed difference could be due to condition, batch, or both. More elaborate correction cannot create comparisons that the study did not observe.
The analysis below treats independent biological samples—not individual cells—as the experimental units for a gene-level expression comparison. A single-cell assay may measure thousands of cells per sample, but cells from the same biological sample are not independent biological replicates. The examples use hypothetical sample-level expression summaries, in arbitrary normalized expression units. The numbers illustrate the reasoning and are not from a real study.
The goal is to make a sequence of linked decisions: inspect overlap, define the model, check its rank, identify the estimable contrast, assess whether the model is credible, and state the conclusion at the strength the design permits.
Model, Rank, and Estimability
For a simple two-batch, two-condition comparison, let \(y_i\) be the expression summary for biological sample \(i\), let \(T_i=1\) for treated samples and \(0\) for controls, and let \(B_i=1\) for batch 2 and \(0\) for batch 1. The additive linear model is
Here, \(\beta_0\) is the expected expression for a control sample in batch 1, \(\tau\) is the treated-minus-control contrast after adjusting for batch, and \(\delta\) is the batch-2-minus-batch-1 contrast after adjusting for condition. The model assumes that these effects are additive: it does not include a condition-by-batch interaction. For the usual exact small-sample \(t\)-based inference, it also assumes independent errors with mean zero, common variance, and a normal distribution. A fitted contrast is not automatically scientifically meaningful just because software returns a number; the design and assumptions must be examined.
The equivalence follows directly. If \(Xv=0\), then \(\beta\) and \(\beta+v\) give identical fitted means, because \(X(\beta+v)=X\beta\). The contrast has the same value at both coefficient vectors exactly when \(c^\mathsf{T}(\beta+v)=c^\mathsf{T}\beta\), or \(c^\mathsf{T}v=0\). Thus a nonzero null-space direction that changes the contrast proves non-estimability.
In this model, \(\tau\) is the contrast \(c^\mathsf{T}\beta\) with \(c=(0,1,0)^\mathsf{T}\). The batch-condition table should be checked before fitting: empty cells can remove comparisons, while very sparse cells can make estimates unstable. Rank is a mathematical check for exact aliasing; it does not guarantee good precision or an adequate model.
Worked Example: Perfect Confounding in the Batch Table
Suppose a hypothetical study has four control samples, all in batch 1, and four treated samples, all in batch 2. Their sample-level expression means are 10 and 16 units, respectively. The batch-condition table has no samples in either off-diagonal combination.
| Batch | Control samples | Treated samples |
|---|---|---|
| Batch 1 | 4 | 0 |
| Batch 2 | 0 | 4 |
For the model with columns \((1,T,B)\), the only two distinct design rows are \((1,0,0)\) and \((1,1,1)\). Therefore, the three columns are linearly dependent and the design matrix has rank 2, not 3. In particular, \(v=(0,1,-1)^\mathsf{T}\) satisfies \(Xv=0\), but \(c^\mathsf{T}v=1\) for \(c=(0,1,0)^\mathsf{T}\). The condition contrast \(\tau\) is not estimable.
The observed difference in means is \(16-10=6\) expression units. Under the additive model, it identifies \(\tau+\delta=6\), not \(\tau\) alone. For example, \((\tau,\delta)=(6,0)\) and \((\tau,\delta)=(2,4)\) both give the same expected group difference. Reporting 6 as an adjusted condition effect would therefore overstate what these data identify.
When Overlap Makes an Adjusted Contrast Possible
With observations in all batch-condition combinations, the additive model can compare conditions within batch and combine those comparisons. Overlap is essential to that interpretation. The estimate can still be imprecise, and the additive assumption may still be wrong, but the condition contrast is no longer exactly aliased with batch.
Worked Example: Fitting an Additive Model With Overlap
Consider eight hypothetical biological samples, two in each batch-condition combination. The values are normalized expression units for one gene.
| Batch | Condition | Sample values | Cell mean |
|---|---|---|---|
| Batch 1 | Control | 8, 10 | 9 |
| Batch 1 | Treated | 13, 15 | 14 |
| Batch 2 | Control | 10, 12 | 11 |
| Batch 2 | Treated | 15, 17 | 16 |
Every combination is represented, so the design matrix for \((1,T,B)\) has rank 3. The within-batch condition differences are \(14-9=5\) in batch 1 and \(16-11=5\) in batch 2. Because the table is balanced, the fitted additive-model estimate is their average:
The fitted cell means are 9, 14, 11, and 16. In each cell the two residuals are \(-1\) and \(1\). Thus all four cells contribute two squared residuals:
There are eight sample observations and three fitted coefficients, so \(df=8-3=5\). The residual mean square is \(MSE=SSE/df=8/5=1.6\) squared expression units. Under the independent, common-variance error model, this balanced design gives
The four terms inside the parentheses are the squared coefficients of the four cell means in the balanced contrast; each cell mean is based on two samples. If the sample errors are independent and normal with common variance, a 95% \(t\) interval uses \(t_{0.975,5}\approx2.571\):
In this hypothetical example, the interval is a model-based range of plausible values for the adjusted treated-minus-control contrast. It is not a 95% probability that the fixed contrast lies in this particular interval. With only eight samples, the assumptions and the small residual degrees of freedom deserve careful attention; this calculation is an illustration, not a claim that such a model is adequate for every single-cell study.
Sensitivity Analysis When the Effect Is Not Identified
When the design cannot separate condition and batch, sensitivity analysis makes the missing information explicit. It does not repair the rank deficiency or estimate the unknown batch effect from the confounded data. Instead, it asks how the condition conclusion would change under specified, scientifically motivated values or ranges for that effect.
Worked Example: How an Assumed Batch Effect Changes the Conclusion
Return to the perfectly confounded study, where the observed treated-minus-control difference is 6 expression units. Under the additive model, the difference equals \(\tau+\delta\). If a sensitivity analysis posits a particular value of \(\delta\), the corresponding condition contrast is the observed difference minus that assumed batch effect.
For an assumed batch effect of 0 units, the implied condition contrast is \(6-0=6\) units. If the assumed batch effect is 2 units, the implied contrast is \(6-2=4\) units. If it is 5 units, the implied contrast is \(6-5=1\) unit. More generally, if subject-matter knowledge supports only the range \(1\leq\delta\leq4\), then the implied condition contrast ranges from \(6-4=2\) to \(6-1=5\) units.
These are conditional results, not estimates of \(\delta\) and not confidence intervals for \(\tau\). The data in this fully confounded design cannot choose among them. A defensible report would state the observed 6-unit combined difference, explain that the condition effect is not separately identifiable, and disclose which assumed batch-effect values produce each sensitivity result.
Diagnostics, Alternatives, and Limits
A practical audit should combine the table, the model, and the scientific question. A rank check can detect exact linear dependence, while singular values or a condition-number diagnostic can warn that columns are nearly dependent. Near-aliasing may leave the contrast technically estimable but highly uncertain. The common-support check asks a complementary question: are the conditions actually represented within the batches needed for the intended comparison?
After fitting an identifiable model, inspect residuals for outliers, unequal spread, and patterns associated with batch or fitted values. Compare condition differences within each batch rather than relying only on the pooled difference. A large disagreement between within-batch contrasts may signal an interaction or other model failure. With very few biological samples, such diagnostics have low power; absence of an obvious pattern is not proof that assumptions hold. Negative controls can help diagnose unwanted technical variation, but they do not manufacture condition overlap.
The main alternatives answer different questions. An additive covariate-adjusted model estimates a common condition contrast when overlap supports it and the no-interaction assumption is reasonable. Separate within-batch comparisons avoid imposing one common contrast, but require both conditions within each batch and may be imprecise. Omitting batch estimates a marginal observed difference that may combine batch and condition. In a fully confounded design, none of these choices recovers a condition effect from the data alone. A corrected embedding can be useful for visualization, but visual mixing is not evidence that the original design identifies a condition contrast.
An additive model also has limits even when it has full rank. It assumes a shared condition effect across batches; an interaction model asks whether the condition contrast varies by batch and needs adequate observations in the relevant combinations. More generally, the conclusion applies to the measured samples, chosen expression summary, and model—not automatically to every cell, gene, or target population. The earlier material on sensitivity analysis and leave-one-batch-out diagnostics provides useful complementary checks, but neither substitutes for the rank and overlap audit.
Count independent biological samples in every batch-condition combination; flag empty or very sparse cells.
State what the condition effect means, which batch terms are included, and whether interactions are being assumed absent.
Confirm that the intended contrast is estimable, then assess whether near-aliasing could make it unstable.
Review residuals and within-batch contrasts; when the effect is not identified, show results across explicit assumptions rather than presenting one assumption as data-derived.
Give the estimate and uncertainty only when justified, and name the design or assumptions that limit interpretation.
Common Pitfall: Treating a Model Output as Identification
A common mistake is to fit a model to perfectly confounded data, see a numerical coefficient or corrected visualization, and report that number as the adjusted condition effect. The correction is to inspect the design matrix and test the requested contrast for estimability before interpreting an output. Software may choose one of many coefficient solutions, impose a constraint, drop a term, or report a combined contrast. None of those actions adds information about the missing comparison. State what is identified, what depends on assumptions, and what additional samples would be needed to distinguish condition from batch.
Check Your Understanding
Try each question, then check the solutions below.
- In a model with intercept, treatment, and batch indicators, every control is in batch 1 and every treated sample is in batch 2. Is the treatment coefficient estimable? Give the key reason.
- In the balanced worked example, what is the adjusted treatment estimate, and what expression units does it use?
- For that example, verify the residual sum of squares using the residuals in all four cells.
- In the perfectly confounded example, what treatment contrast is implied if the assumed batch effect is 3 expression units?
- Why does a mixed-looking corrected embedding not establish that the condition effect is identified?
Solutions. (1) No. The treatment and batch indicators are identical, so the design has rank 2 rather than 3; the data identify their combined contrast, not either coefficient separately. (2) The estimate is the mean of the two within-batch differences, \((5+5)/2=5\) expression units. (3) Each of four cells has residuals \(-1\) and \(1\), so \(SSE=4(1+1)=8\) squared expression units. (4) The implied contrast is \(6-3=3\) expression units; this is conditional on the assumed batch effect. (5) An embedding is a transformed representation, not new within-batch condition comparisons; visual mixing cannot resolve exact confounding in the sample design.