Tutorials › Statistical Genetics › Batch Effects And Identifiability In QTL Mapping

Molecular QTL Mapping · Tutorial 894 of 989

Batch Effects And Identifiability In QTL Mapping

Assess whether batch adjustment can separate technical shifts from a QTL effect, and identify when genotype–batch confounding makes that effect unidentifiable.

Advanced 13 min read

What You'll Learn

  • Specify a QTL regression model that includes technical batch effects
  • Check whether genotype varies within batches enough to identify its coefficient
  • Distinguish partial confounding, which can inflate uncertainty, from perfect confounding
  • Use residualized genotype to derive the adjusted estimate and its standard error
  • Explain why no statistical adjustment can recover an effect under perfect confounding
  • Recognize how imbalance across batches can distort an unadjusted association

Why Batch and Identifiability Matter

Molecular measurements can differ systematically across assay plates, processing dates, reagent lots, sequencing runs, or laboratories. Such a batch effect is a technical shift in the measured phenotype associated with how or when samples were processed. If genotype groups are distributed differently across batches, a measured genotype–expression association can combine a biological QTL effect with a technical difference. Including batch in a regression model can separate these contributions only when the observed design contains enough genotype variation independent of batch.

This is an identifiability question, not merely a question of which software option to select. If each genotype occurs in multiple batches, the model may distinguish batch shifts from the genotype slope. If genotype and batch are perfectly aligned, the data contain no comparison that can tell those effects apart. No adjustment method can create that missing comparison.

A QTL Model With Batch Effects

For one molecular phenotype measured in \(n\) donors, let \(y_i\) be the phenotype for donor \(i\), and let \(g_i\) be that donor's genotype dosage at the variant, conventionally coded as 0, 1, or 2 copies of the effect allele. Let \(b_i\) denote the technical batch. A fixed-effects model with \(K\) batches can be written using an intercept and \(K-1\) batch indicators:

$$ y_i=\alpha+\beta g_i+\sum_{k=2}^{K}\gamma_k I(b_i=k)+\varepsilon_i. $$

Here, \(\beta\) is the expected difference in the phenotype per additional effect-allele copy, holding batch fixed. Each \(\gamma_k\) is the mean shift for batch \(k\) relative to the reference batch, holding genotype fixed. For the ordinary least-squares interpretation and standard errors used below, assume the conditional mean follows this additive model, the errors have mean zero given genotype and batch, and the errors are independent with a common variance. These assumptions concern the model and inference; they do not guarantee that the design can identify \(\beta\).

Definition: The genotype effect \(\beta\) is identifiable conditional on batch when the observed genotype values contain variation that cannot be represented entirely by the intercept and batch indicators. Equivalently, after accounting for batch, the genotype column is not zero.

This condition is also described using matrix rank. Let \(Z\) contain the intercept and batch indicators, and let \(g\) be the vector of genotype dosages. The coefficient \(\beta\) is identifiable in the model with batch if adding \(g\) to \(Z\) increases the rank of the design matrix. In practical terms, there must be genotype contrasts within at least some batches. Genotypes need not be equally frequent in every batch, but genotype cannot be a deterministic function of batch.

Residualizing Genotype: A Short Justification

The role of within-batch genotype variation can be made precise. Let \(P_Z\) project a vector onto the columns of \(Z\), and let \(M_Z=I-P_Z\) remove its fitted intercept and batch means. Thus \(\tilde{g}=M_Zg\) is the genotype vector after subtracting its batch-specific mean (and the corresponding intercept representation). The same operation on the phenotype gives \(\tilde{y}=M_Zy\).

The least-squares estimate of the genotype coefficient is the slope obtained from these residualized vectors:

$$ \hat{\beta}=\frac{\tilde{g}^{\mathsf T}\tilde{y}}{\tilde{g}^{\mathsf T}\tilde{g}} =\frac{g^{\mathsf T}M_Zy}{g^{\mathsf T}M_Zg}. $$

To see why, first choose any fixed value of \(\beta\). The best-fitting batch and intercept coefficients minimize the squared residuals after removing the part explained by \(Z\). The remaining squared error is \((y-\beta g)^{\mathsf T}M_Z(y-\beta g)\). Expanding this quadratic in \(\beta\), differentiating, and setting the derivative to zero gives

$$ -2g^{\mathsf T}M_Zy+2\beta g^{\mathsf T}M_Zg=0, \qquad \hat{\beta}=\frac{g^{\mathsf T}M_Zy}{g^{\mathsf T}M_Zg}. $$

This division is valid exactly when \(g^{\mathsf T}M_Zg>0\). If that quantity is zero, the genotype vector lies entirely in the span of the intercept and batch indicators; there is no residualized genotype contrast. Under the stated common-variance model, when the coefficient is identifiable, its standard error is estimated by

$$ SE(\hat{\beta})=\sqrt{\frac{\hat{\sigma}^{2}}{g^{\mathsf T}M_Zg}}, \qquad \hat{\sigma}^{2}=\frac{SSE}{df}, \qquad df=n-\operatorname{rank}([Z\ \ g]). $$

As genotype–batch imbalance increases, the remaining genotype variation can become small. The model may still identify \(\beta\), but the standard error can grow because the denominator \(g^{\mathsf T}M_Zg\) is small.

Worked Example: Perfect Genotype–Batch Confounding

Suppose a hypothetical assay measures four donors in two batches. Both donors in batch A have genotype dosage 0 and expression values 5 and 6 units. Both donors in batch B have dosage 1 and expression values 12 and 13 units. Consider the model \(y_i=\alpha+\beta g_i+\gamma I(b_i=B)+\varepsilon_i\).

For every donor, \(g_i=I(b_i=B)\). The genotype column is therefore identical to the batch-B indicator, so adding genotype does not increase the design-matrix rank. The model's fitted mean for batch B contains \(\beta+\gamma\), not separately estimable values of \(\beta\) and \(\gamma\). For example, replacing \(\beta\) by \(\beta+c\) and \(\gamma\) by \(\gamma-c\) leaves every fitted value unchanged, for any constant \(c\).

The observed difference between the batch means is \(12.5-5.5=7.0\) expression units. It cannot be assigned uniquely to genotype, batch, or a combination of the two. A software package might drop a redundant column or report a coefficient under an imposed constraint, but that convention does not make the genotype effect identified by these data.

Partial Confounding: Adjustment Is Possible, but Less Precise

With partial rather than perfect confounding, some batches contain more of one genotype than another, but the genotype distributions are not identical across batches. If at least one batch has within-batch genotype variation, the genotype coefficient can generally be estimated under the additive model. It is estimated from those within-batch contrasts, not from the between-batch differences that the batch indicators absorb.

Worked Example: An Adjusted QTL Estimate and Its Standard Error

Consider hypothetical expression values in two batches. The genotypes and measurements are listed in donor order:

BatchGenotype dosagesExpression values (units)
A0, 1, 0, 19.75, 12.25, 10.25, 10.75
B0, 1, 1, 012.25, 12.75, 14.25, 11.75

Both genotype dosages occur in each batch, so genotype is not perfectly confounded with batch. The within-batch genotype variation is nonzero. For each batch, the genotype mean is 0.5, so the residualized dosage vectors are \((-0.5,0.5,-0.5,0.5)\) in A and \((-0.5,0.5,0.5,-0.5)\) in B. Their squared values sum to \(1\) in each batch; hence \(g^{\mathsf T}M_Zg=2\).

The fitted genotype coefficient is \(1.5\) expression units per allele copy, with batch-specific fitted means at dosage 0 of 10 units in A and 12 units in B. Subtracting the fitted values from the observations gives residuals \((-0.25,0.75,0.25,-0.75)\) in A and \((0.25,-0.75,0.75,-0.25)\) in B. The residuals sum to zero within each batch and are orthogonal to the residualized genotype, as required by least squares.

The sum of squared errors is

$$ SSE=2\{(-0.25)^2+(0.75)^2+(0.25)^2+(-0.75)^2\} =2(1.25)=2.50. $$

There are \(n=8\) observations and three fitted coefficients: an intercept, a batch indicator, and genotype. Thus \(df=8-3=5\), and \(\hat{\sigma}^{2}=2.50/5=0.50\) squared expression units. The estimated standard error is

$$ SE(\hat{\beta})=\sqrt{\frac{0.50}{2}}=0.50 \quad\text{expression units per allele copy}. $$

Under the usual \(t\)-test assumptions, testing \(H_0:\beta=0\) against a two-sided alternative gives \(t=1.5/0.50=3.00\) with 5 degrees of freedom, corresponding to a two-sided \(p\)-value of approximately 0.0301. This small hypothetical analysis provides limited evidence against a zero conditional association under the model; it does not establish a causal effect. The calculation also illustrates that an estimable coefficient can still be imprecise in a small sample.

Why an Unadjusted Association Can Be Misleading

When genotype frequencies differ across batches and batches have different phenotype levels, an unadjusted comparison can combine the within-batch genotype contrast with the between-batch technical shift. Adjustment changes the comparison: the coefficient is estimated using genotype differences after subtracting batch means. The following example shows how the two estimates can differ.

Worked Example: Imbalance Changes the Crude Difference

Suppose a hypothetical study has these observed values:

BatchDosage 0 expression values (units)Dosage 1 expression values (units)
A9, 10, 1111, 13, 12
B1820, 22, 21

The unadjusted mean for dosage 0 is \((9+10+11+18)/4=12.0\) units. The unadjusted mean for dosage 1 is \((11+13+12+20+22+21)/6=16.5\) units. Their crude difference is \(16.5-12.0=4.5\) units per dosage step. But the within-batch differences are only \(12.0-10.0=2.0\) units in A and \(21.0-18.0=3.0\) units in B. The much higher expression level in batch B, where dosage 1 is more common, contributes to the crude difference.

For the additive batch-adjusted model, the residualized-genotype sums of squares in batches A and B are \(3(3)/6=1.5\) and \(1(3)/4=0.75\), respectively. The corresponding weighted within-batch contrasts give the adjusted slope:

$$ \hat{\beta} =\frac{1.5(2.0)+0.75(3.0)}{1.5+0.75} =\frac{5.25}{2.25} =2.333 \quad\text{expression units per allele copy}. $$

The adjusted estimate differs from the crude \(4.5\)-unit difference because it compares genotypes within batches rather than allowing the unequal batch composition to drive the comparison. This estimate relies on the additive model's common genotype slope across batches; if that assumption is not appropriate, one common slope may not summarize the data well.

Diagnosing the Design Before Fitting the Model

A useful first step is to tabulate genotype by batch before interpreting any adjusted result. For a biallelic variant, inspect counts for dosages 0, 1, and 2 in each batch, and look for empty cells or batches with only one observed dosage. A cross-tabulation reveals structural overlap, while a plot of phenotype by genotype, marked by batch, can reveal batch-specific shifts or possible slope differences.

1
Display the assignment pattern.
Count each genotype dosage within each assay batch. Identify batches with no genotype variation and check whether any dosage occurs only in one batch.
2
Check the rank condition.
Confirm that genotype is not an exact linear combination of the intercept and batch indicators. In computational work, inspect design-matrix rank or whether \(g^{\mathsf T}M_Zg\) is positive and meaningfully large.
3
Fit and interpret conditionally.
If the coefficient is identifiable, include batch as specified and interpret \(\hat{\beta}\) as the per-allele association conditional on batch, with its standard error reflecting the available within-batch genotype information.

A positive rank check is not a guarantee of useful precision: a tiny amount of within-batch variation can technically identify a coefficient while leaving it poorly estimated. Conversely, a batch containing only one genotype does not by itself make the entire model unidentified if other batches provide genotype contrasts; it does mean that this batch contributes no within-batch information about the slope.

Adjustment Is Not the Same as Erasing Batch

Including batch as a covariate estimates the genotype association conditional on the batch labels in the model. This is conceptually different from subtracting a batch mean from every phenotype before QTL analysis. A preliminary correction can remove real genotype signal if genotype is associated with batch: the batch mean may itself reflect different genotype composition. If the batch and genotype effects cannot be separated, a correction procedure cannot know which part to preserve.

The most reliable remedy for perfect confounding is at the design stage: distribute genotype groups across processing batches, randomize sample placement where feasible, and retain accurate batch records. When the samples have already been processed and genotype is perfectly confounded with batch, report that the genotype effect is not identified from those data rather than presenting a batch-adjusted estimate as if the design supported it.

Common Mistakes

  • Assuming that adding batch always solves confounding. Adding a covariate only separates effects when the design contains independent variation. Identical genotype and batch indicator columns make the genotype coefficient unidentifiable.
  • Calling partial confounding impossible to adjust. Unequal genotype frequencies across batches do not automatically prevent estimation. If there is sufficient within-batch genotype variation, a conditional slope can be estimated, although its standard error may be larger.
  • Interpreting the crude genotype difference as the adjusted QTL coefficient. When genotype composition and phenotype levels differ across batches, the crude difference mixes within-batch and between-batch comparisons.
  • Treating a reported software coefficient as proof of identification. A program can impose a constraint or omit a redundant column when the design is rank deficient. Such output depends on a convention, not information separating genotype from batch.
  • Assuming adjustment makes the result causal. The coefficient is a conditional association under the stated model. Batch adjustment alone does not establish causation or address every source of bias.
Key takeaway: Batch adjustment can separate technical shifts from a QTL association only when genotype retains variation after batch is accounted for. Partial confounding can leave an estimable but less precise slope; perfect genotype–batch confounding makes the genotype effect unidentifiable.

Check Your Understanding

Answer each question by referring to the design condition, not only to the fitted output.

  1. In a two-batch study, every donor in batch A has dosage 0 and every donor in batch B has dosage 2. Which model terms are confounded, and can the batch-adjusted genotype slope be identified?
  2. Why can genotype variation within only one of several batches still provide information about a common genotype slope?
  3. If \(g^{\mathsf T}M_Zg\) is small but positive, what does that imply about identifiability and precision?
  4. A crude expression difference is 5 units per allele step, while the batch-adjusted estimate is 2 units. Give a design-based explanation for why they may differ.
  5. Why is subtracting batch means before fitting a QTL model not automatically a safe substitute for modeling batch and genotype together?
Clinical Biostats