Why Continuous Technical Variables Need Their Own Confounding Checks
A technical variable such as processing date, library depth, or a library-quality score may vary continuously rather than forming a small set of named batches. The key diagnostic question is whether its values are distributed similarly across biological conditions. If, for example, most samples from one condition were processed later than samples from another, an observed condition difference may be difficult to distinguish from a time-related technical difference. This imbalance is evidence about the study design; by itself, it does not establish that the technical variable caused an expression difference.
The appropriate unit for this check is usually the biological sample, not the individual cell. A sample processed on one date may contribute thousands of cells, but those cells do not represent thousands of independent processing dates or condition assignments. Cell-level displays can still be useful for examining within-sample variation, but they should show sample identity or otherwise make the nesting visible. For a sample-level condition comparison, summarize technical measurements at the sample level or use a method that explicitly accounts for the sample structure.
A useful diagnosis combines a plot, numerical summaries, and a simple regression. These describe different aspects of the same relationship. A plot can reveal shape and gaps; a mean difference summarizes location; and a regression gives a concise description of how much condition membership predicts the technical measurement. None of these diagnostics alone proves that a condition effect is unidentifiable, nor does an apparently small imbalance guarantee that adjustment is adequate.
Plots and Numerical Summaries
Start by plotting the continuous technical variable separately for each condition. A strip plot or dot plot shows individual sample values; a boxplot or violin plot can summarize a larger collection. Include sample identifiers when possible, since a group of repeated measurements from one sample should not be mistaken for many independent samples. For a time-like variable, plot the actual dates or elapsed times rather than replacing them immediately with arbitrary categories. Also check whether the recorded values are comparable across samples and whether missingness or measurement limits differ by condition.
For each condition, report the sample size, mean, standard deviation, and a few distribution summaries such as the minimum, maximum, and quartiles. The mean difference is \( \bar{Z}_1-\bar{Z}_0 \), in the units of \(Z\). To express the difference relative to the observed variability, one may use the standardized mean difference \( d=(\bar{Z}_1-\bar{Z}_0)/s_{\mathrm{pooled}} \), where the pooled standard deviation is computed as follows for two groups:
Here \(n_c\) and \(s_c\) are the number of biological samples and the sample standard deviation of \(Z\) in condition \(c\). This standardized difference is a descriptive scale, not a universal pass/fail threshold. Its value depends on the group means and the pooled spread; it does not describe whether the groups overlap across the entire range. Always accompany it with summaries in the original units and a plot.
Worked Example: A Processing-Date Shift Between Conditions
Suppose a hypothetical study has four independent biological samples in each condition. Their processing days, measured from the start of a study, are \(1,2,3,4\) for condition 0 and \(5,6,7,8\) for condition 1. The data are sample-level; the number of cells per sample does not change these eight sample values.
The group means are \( \bar{Z}_0=(1+2+3+4)/4=2.5 \) days and \( \bar{Z}_1=(5+6+7+8)/4=6.5 \) days. The mean difference is \(6.5-2.5=4.0\) days. Each group has sample variance \(5/3\) days squared, since its squared deviations from its mean sum to \(5\), divided by \(4-1=3\). Thus \(s_0=s_1=\sqrt{5/3}=1.291\) days and \(s_{\mathrm{pooled}}=1.291\) days.
The standardized mean difference is \(d=4.0/1.291=3.098\). The condition groups are widely separated relative to their within-group spread. Their observed ranges, 1–4 days and 5–8 days, do not overlap. This is a strong warning that condition and processing date are aligned in these hypothetical samples. It does not tell us what expression would have been observed if both conditions had been processed on the same dates.
Regression as a Descriptive Imbalance Summary
A simple linear regression can summarize the association between condition and a continuous technical variable. Fit condition as the predictor and the technical measurement as the response:
In this diagnostic, \(\gamma_0\) is the fitted mean technical value for condition 0, and \(\gamma_1\) is the fitted difference between the condition 1 and condition 0 means. The regression is not an expression model and does not estimate a biological condition effect on gene expression. It is a compact way to summarize how condition and the measured technical variable align.
The interpretation of this regression does not require normally distributed errors when it is used only to describe the observed group means. If uncertainty intervals or tests for the slope are added, their validity requires an appropriate sampling model, including independent biological samples and a suitable error-variance assumption or a method that accounts for its failure. A small p-value is not a measure of practical imbalance, and a large p-value is not evidence that the groups are balanced—especially with few samples.
The fitted slope is in the original units of \(Z\), which helps with interpretation. The regression \(R^2\) can also describe the fraction of observed sample-level variation in \(Z\) accounted for by the binary condition predictor in this one-predictor linear fit. It is not a universal measure of confounding: it can obscure distributional differences and depends on the variability of \(Z\) in the particular data.
Worked Example: Library Quality With Partial Range Overlap
Consider hypothetical sample-level quality scores between 0 and 1. Condition 0 has values \(0.70, 0.74, 0.78, 0.82\); condition 1 has values \(0.76, 0.80, 0.84, 0.88\). Higher scores indicate better measured library quality.
The means are \( \bar{Z}_0=0.76 \) and \( \bar{Z}_1=0.82 \), so the difference is \(0.06\) quality-score units. In each group, the squared deviations from its mean sum to \(0.008\). Thus each sample variance is \(0.008/3=0.002667\), and each sample standard deviation is \(0.05164\). The pooled standard deviation is also \(0.05164\), giving \(d=0.06/0.05164=1.162\).
The observed ranges overlap from 0.76 to 0.82, unlike the processing-date example, but the groups are not centered at the same value. A plot would show that the condition 1 scores tend to be higher, while the ranges are not completely separated. The fitted regression slope of quality score on condition is \(0.06\). The appropriate conclusion is that this small hypothetical data set shows a noticeable location shift with some range overlap—not that quality is adequately balanced or that adjustment will necessarily resolve its relationship with condition.
Why a Mean Difference Is Not the Whole Diagnosis
A mean difference and a linear regression slope focus on location. They can miss differences in spread or shape, including cases where a relationship is nonlinear. Therefore inspect the plotted distributions and compare their ranges or quantiles as well. In particular, note whether many samples in one condition lie in a part of the technical-variable range with few or no samples from the other condition. This is a practical overlap summary, not a guarantee that a model can safely extrapolate into such a region.
Worked Example: Equal Means but Different Date Distributions
Suppose condition 0 has hypothetical processing-day values \(0,0,4,4\), while condition 1 has \(1,1,3,3\). Both means are \(2\) days, so the mean difference is \(0\) days and the regression slope from condition to processing day is zero.
However, the distributions are not identical: condition 0 has two samples at each extreme, while condition 1 has all four samples between days 1 and 3. The sample variances are \(16/3=5.333\) days squared for condition 0 and \(4/3=1.333\) days squared for condition 1. A display of the individual values makes this difference in spread clear, even though the mean comparison does not.
This example shows why the regression and standardized mean difference should not replace a plot. If technical effects vary nonlinearly over time, a difference in the distribution of dates may matter even when the average dates match. The diagnostic conclusion is that a zero mean difference alone is insufficient to establish balance.
Assumptions, Diagnostics, and Common Pitfalls
For these summaries to answer the intended question, the observations should correspond to the biological samples whose conditions are being compared, and the technical measurement should have a consistent meaning across samples. If samples are clustered within donors or another higher-level unit, that dependence should be kept visible rather than treated as independent replication. The simple regression above assumes a linear description only insofar as its slope is interpreted as a mean difference; it does not claim that a biological or technical process is linear across all values of \(Z\).
Look for unusually influential samples, data-entry errors, restricted measurement ranges, and condition-specific missingness. Check whether the apparent pattern is driven by one sample, and compare group summaries with and without any justified data-quality exclusions. Do not discard observations simply because they reduce the appearance of imbalance. For a processing-time variable, a scatter or strip plot can reveal clusters, gaps, or a curved pattern that a single slope conceals. For library quality, check whether the score has floor or ceiling effects that compress differences.
- Mistake: treating a nonsignificant slope as evidence of balance. With few independent samples, the estimate may be imprecise. Report the observed difference and distributions; do not interpret failure to reject a null hypothesis as proof of equivalence.
- Mistake: relying only on a mean difference. Equal means can coexist with different spreads or shapes. Inspect the individual observations and distribution summaries.
- Mistake: counting cells as independent sample replicates. A large cell count cannot compensate for having few independent biological samples when condition or processing is assigned at the sample level.
- Mistake: treating imbalance as proof of a technical cause. A relationship between condition and processing date identifies an alignment in the observed design. It does not, on its own, establish that date caused an expression difference or determine what adjustment will do.
Plots, regression, and overlap summaries complement one another. A plot is best for seeing shape and individual samples; a mean difference or regression slope gives a concise location contrast in meaningful units; standardized differences help compare location shifts across technical variables with different scales. Range and quantile comparisons expose gaps or limited representation. No single summary substitutes for the others, and no diagnostic can manufacture information where one condition was never observed at particular technical values.
Check Your Understanding
Try each question first, then compare your reasoning with the solutions.
- Condition 0 has technical values \(2,4,6\), and condition 1 has values \(5,7,9\). What is the mean difference, and what is the fitted slope when the technical variable is regressed on condition?
- Why should a study with many cells but only a few biological samples not use the cell count as the sample size for a sample-level condition-imbalance check?
- Two conditions have the same mean processing day. Name two distributional features that could still differ and explain how to check them.
- A regression slope has a large p-value in a study with very few samples. What can and cannot be concluded about condition imbalance?
Solutions. 1. The means are \(4\) and \(7\), so the difference and fitted slope are \(7-4=3\) technical-variable units, with condition 1 higher. 2. Cells from one biological sample share sample-level condition and processing information, so they are not independent biological replicates; inspect sample-level values or use an analysis that accounts for nesting. 3. The spreads and distribution shapes can differ despite equal means; plot individual sample values and compare standard deviations, ranges, or quantiles. 4. The data do not establish that the groups are balanced. With few samples, the estimate may be imprecise; report the observed slope and distributions, and avoid treating a large p-value as proof of no imbalance.