Why Check the Design Before Collecting Samples?
A planned analysis can include the right scientific question and the right covariates yet still be unable to distinguish their effects. For example, if every sample in condition A is processed in one batch and every sample in condition B in another, a measured difference between conditions is also a difference between batches. Collecting more samples with that same allocation does not resolve the ambiguity. A design-matrix rank check makes this structural problem visible before data collection.
For a single-cell study, rows of the design matrix usually correspond to the independent biological samples or experimental units used in the analysis, such as donors or donor-condition samples. They do not automatically correspond to individual cells: cells from one donor are not independent experimental units merely because they are separate observations. The appropriate row unit depends on the planned analysis and on how the condition was assigned.
The rank concerns the planned predictors, not the observed response values. A design is full column rank when \(\operatorname{rank}(X)=p\). In that case, no column is an exact linear combination of the others, and the coefficient vector in the specified parameterization is uniquely determined by the mean vector. If the matrix is rank deficient, some different coefficient vectors produce exactly the same fitted means.
What Rank Deficiency Means
Suppose \(X\) is rank deficient. Then there is a nonzero vector \(v\) such that \(Xv=0\). For any coefficient vector \(\beta\),
Thus the design cannot distinguish \(\beta\) from \(\beta+v\). The direction \(v\) describes an alias: a change in one or more coefficients that leaves every planned mean unchanged. This is an identifiability problem, not a problem that more sequencing depth can solve. Replicating the same rows of \(X\) adds information about those rows’ means but does not create a new predictor pattern or remove an exact alias.
Sometimes the scientific target is a contrast rather than every coefficient separately. Write the target as \(c^\mathsf{T}\beta\), where \(c\) is a specified vector. This target is estimable exactly when it has the same value for every coefficient vector that gives the same mean. The condition is that \(c^\mathsf{T}v=0\) for every \(v\) in the null space of \(X\). Equivalently, \(c\) must lie in the row space of \(X\).
If \(X\beta=X\beta'\), then \(X(\beta-\beta')=0\). The difference \(v=\beta-\beta'\) lies in the null space of \(X\).
The target changes by \(c^\mathsf{T}\beta-c^\mathsf{T}\beta'=c^\mathsf{T}v\). It is identifiable only if this difference is zero for every null-space vector \(v\).
The vectors orthogonal to every null-space vector are precisely the row space of \(X\). Therefore \(c^\mathsf{T}\beta\) is estimable if and only if \(c\) is in that row space.
Full column rank is a convenient sufficient condition for estimating every coefficient in the specified model, but it is not required for every particular contrast to be estimable. Conversely, a software package returning coefficient values after rank deficiency does not make all coefficients identified: it may have dropped columns or imposed a constraint to select one solution from many equivalent ones.
Worked Example: Condition Completely Aliased With Batch
Suppose a hypothetical study plans four donor samples: two in condition A processed in batch 1, and two in condition B processed in batch 2. Let \(T=1\) indicate condition B and \(B=1\) indicate batch 2. With an intercept, the planned matrix is
The second and third columns are identical because \(B=T\) in every row. Hence \(\operatorname{rank}(X)=2\), not 3. In the model \(E(Y)=\beta_0+\beta_T T+\beta_B B\), the predicted mean for condition A is \(\beta_0\), and that for condition B is \(\beta_0+\beta_T+\beta_B\). The data can identify the combined difference \(\beta_T+\beta_B\), but cannot separate it into a condition effect and a batch effect.
For instance, \(v=(0,1,-1)^\mathsf{T}\) satisfies \(Xv=0\). Moving from \((\beta_0,\beta_T,\beta_B)\) to \((\beta_0,\beta_T+1,\beta_B-1)\) leaves all fitted means unchanged. The condition coefficient alone is therefore not estimable after adjustment for batch. Adding more donors in the same condition-batch pairings would repeat existing rows and would not remove this alias.
Check the Terms You Actually Plan to Estimate
Rank depends on both the allocation and the model terms. An additive model with condition and batch may have full column rank even when some combinations are absent, while a model that also includes a condition-by-batch interaction may not. That distinction matters: a design can support an additive comparison under an assumption of no interaction without supporting a separate interaction effect.
Worked Example: An Additive Comparison Is Estimable but an Interaction Is Not
Consider three hypothetical sample types: condition A in batch 1, condition A in batch 2, and condition B in batch 1. Let \(T=1\) indicate condition B and \(B=1\) indicate batch 2. For an additive model with columns intercept, \(T\), and \(B\), the matrix is
This square matrix has
Because the determinant is nonzero, its rank is 3, so all three additive coefficients are identifiable. The condition coefficient represents the condition B versus A difference at batch 1 under this coding and the additive model.
Now add the interaction column \(TB\). In the observed rows, \(TB=0\) throughout because the condition B, batch 2 combination is absent. The added column is therefore all zeros, and the four-column matrix still has rank 3. The interaction coefficient cannot be estimated. The additive condition comparison is supported by the observed condition A and B samples in batch 1, but a condition-specific change across batches cannot be learned from this allocation.
The coding of categorical variables should be explicit. With an intercept, using an indicator for every category can create a redundant column because the indicators sum to one; reference coding or another full-rank contrast coding avoids that particular redundancy. Changing from one valid full-rank coding to another does not create information, but it can make the coefficient interpretation clearer. The scientific target should be checked as a contrast, not inferred from the coefficient labels alone.
Worked Example: A Redundant Covariate Encoding
Suppose a hypothetical design has two samples in condition A and two in condition B. The analyst includes an intercept, an indicator \(T\) for condition B, and a numeric variable \(C\) coded as 1 for A and 2 for B. The columns are
Here \(C=1+T\), so the third column is the sum of the first two. The rank is 2, not 3. A null-space vector is \(v=(-1,-1,1)^\mathsf{T}\), since \(-1-T+C=0\) for every row. Consequently, the three coefficients cannot be estimated separately. Including both encodings of the same condition does not adjust for an additional factor; it duplicates information already in the matrix.
The remedy is to use one condition representation, not to interpret a software-selected coefficient as an independently adjusted effect. If \(C\) represented a distinct measured characteristic rather than another encoding of condition, the study would need enough variation in that characteristic across conditions to distinguish its column from the condition column.
Practical Rank and Alias Diagnostics
A pre-collection check should use the complete planned design matrix: every intended sample-level row, model term, and coding choice. A QR decomposition or singular-value decomposition can assess rank and reveal dependent columns. Exact arithmetic is useful for simple indicator designs; numerical software uses a tolerance, so its reported rank can depend on scaling and the selected tolerance. Inspect the columns and the suspected dependencies rather than treating a software rank flag as a full explanation.
An exact alias and a near alias are different. An exact alias gives a nonzero \(v\) with \(Xv=0\); the corresponding effects cannot be separated at all. With near-collinearity, the columns are not exactly dependent, so the matrix may have full rank, but some combinations are represented by very little independent variation. Very small singular values relative to the largest one, or a large condition number, can flag this instability. Coefficients may then be highly sensitive to small changes in the data, and their standard errors may be large.
For example, if almost every condition B sample is in batch 2 but a few condition A samples also appear in batch 2, condition and batch need not be exactly aliased. The few discordant allocations may make the condition effect formally identifiable, yet provide limited information for separating it from batch. Rank alone does not measure how precise the estimated contrast will be.
A useful diagnostic sequence is:
- Write the planned rows and terms, including the intended interaction terms, before fitting a model.
- Check for duplicate columns, columns that are sums or multiples of others, and all-zero columns.
- Compute numerical rank and inspect any null-space or alias relations.
- For each scientific target, verify that its contrast is estimable; then separately consider near-collinearity and the amount of independent allocation supporting it.
- Revise the allocation or simplify the scientific question before collecting samples when the target is not identified.
A cross-tabulation of condition by batch is often a useful visual check because it displays empty combinations and sparse overlap. It is not a substitute for checking the actual design matrix: additional terms, repeated-measures structure, or alternative coding can introduce dependencies not obvious from one table. Pairwise correlations are also insufficient; a column can be an exact combination of several others without being highly correlated with any one of them.
Interpretation, Alternatives, and Limits
The strongest design remedy for confounding is usually to create overlap: allocate conditions across batches so that the target comparison is supported within batch, where feasible. If the design cannot be changed, the model must reflect what is actually identifiable. Removing a batch term may produce a condition coefficient, but it changes the assumption and interpretation: the coefficient can absorb batch differences. It does not recover a separately identified condition effect.
Alternative parameterizations can resolve redundant coding, but cannot resolve a lack of information in the allocation. Dropping an interaction may yield an estimable additive model, but that analysis assumes the interaction is absent or irrelevant to the target. A rank check diagnoses structural identifiability; it does not validate the model, establish causation, guarantee adequate precision, or account for biological variability. In generalized linear models, such as models for counts, full rank is likewise a structural check on the linear predictor, not a guarantee that all likelihood-based estimates exist or behave well. Other model-specific problems can remain.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- If a design matrix has 5 columns but rank 4, what does that imply about the coefficient vector and fitted means?
- In a design with an intercept and condition indicator \(T\), a second covariate is coded exactly as \(C=1+T\). Which problem occurs, and what is a sensible correction?
- A planned condition-by-batch table lacks the condition B, batch 2 combination, but the additive design matrix has full column rank. What can and cannot be concluded about an interaction?
- Why can adding more samples in the same condition-batch combinations fail to resolve exact confounding?
- What is the distinction between full rank and a well-conditioned design?
Solutions. (1) At least one nonzero coefficient direction lies in the null space, so multiple coefficient vectors give the same fitted means; the coefficients are not all separately identifiable. (2) The columns are linearly dependent because \(C\) is the intercept column plus \(T\). Remove the duplicate encoding or use one clear condition coding. (3) The specified additive coefficients may be identifiable, but the missing combination prevents estimating the interaction from these rows; an additive condition comparison relies on the additive model. (4) Repeating the same rows does not add a new predictor pattern, so the columns remain dependent. (5) Full rank means no exact column dependence. A well-conditioned design also needs predictor patterns with enough independent variation; a full-rank matrix can still be close to rank deficient and yield unstable estimates.