Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Sensitivity to Cell-Type Annotation Uncertainty

Differential Abundance and Compositional Effects · Tutorial 550 of 700

Sensitivity to Cell-Type Annotation Uncertainty

Compare hard-label and probabilistic-label abundance analyses, then assess whether plausible annotation changes alter the condition contrast or the evidence for it.

Advanced 11 min read

What You'll Learn

  • Distinguish hard cell labels from probabilities over all cell types.
  • Calculate expected cell-type counts and proportions from probabilistic labels.
  • Re-estimate a condition contrast after plausible label reassignment.
  • Compare effect direction and test strength across annotation scenarios.
  • Diagnose when uncertain or condition-dependent labels make an abundance result fragile.
  • Separate annotation uncertainty from biological sampling uncertainty.

Why Annotation Uncertainty Matters

A differential-abundance analysis treats each cell as belonging to a cell type, but some cells may be difficult to classify. A hard-label analysis assigns each cell one label and then proceeds as if that assignment were certain. When many cells have ambiguous labels, this can make the estimated abundance contrast depend on arbitrary choices near classification boundaries. The practical question is not only how uncertain the labels are, but whether plausible alternatives change the direction or strength of the condition contrast.

This tutorial treats annotation uncertainty as a sensitivity problem: keep the abundance-analysis design and model fixed, vary the plausible cell labels, and compare the resulting condition contrasts. The earlier material on posterior predictive checks concerns whether a fitted compositional model can reproduce relevant features of the observed data; label sensitivity asks a different question about whether the abundance conclusion is robust to uncertain cell identities.

Definition: For cell \(i\) and cell type \(k\), let \(q_{ik}\) be the probability assigned to type \(k\) by an annotation procedure. For each cell, the probabilities across the full set of \(K\) types satisfy \(q_{ik}\geq 0\) and \(\sum_{k=1}^{K}q_{ik}=1\). A hard label assigns one type to the cell, often the type with the largest \(q_{ik}\). A probabilistic label retains the full vector of probabilities.

These probabilities are useful for sensitivity analysis only to the extent that they represent plausible uncertainty. They might come from a probabilistic classifier, repeated annotation by experts, or a specified set of alternative labels. They are not automatically calibrated probabilities that the label is correct. A model that reports \(q_{ik}=0.8\) should be checked, when possible, against independent reference annotations or other evidence. Annotation probabilities also do not replace the biological replicates: in condition comparisons, the sample or donor generally remains the unit of replication, not the individual cell.

From Cell-Level Probabilities to Abundance Contrasts

For sample \(j\), let \(n_j\) be the number of cells and let \(q_{ijk}\) be the probability that cell \(i\) in that sample belongs to type \(k\). The expected count for type \(k\), given these probabilities, is the sum of its cell-level probabilities. Dividing by the fixed total number of cells gives the expected proportion.

$$ \widetilde{C}_{jk}=\sum_{i=1}^{n_j}q_{ijk}, \qquad \widetilde{p}_{jk}=\frac{\widetilde{C}_{jk}}{n_j}. $$

The resulting counts can be fractional. For example, a count of 3.4 means that the cell-level probabilities sum to 3.4; it does not mean that a sample contains a fractional cell. The vector of expected counts still sums to \(n_j\), because each cell’s probabilities sum to one. The expected proportions therefore sum to one as well.

One can use these expected proportions in a fixed sample-level abundance analysis, or repeatedly draw plausible labels and refit that analysis. The first approach uses the average of the cell-level probabilities. The second represents uncertainty about which labels were assigned: for each draw, assign a type to each cell according to its full probability vector, recalculate the sample counts and proportions, and refit the same model. For multicategory labels, a draw must use the probabilities for all types. The probability of a target type alone is not enough to infer the most probable label.

Justification: Let \(Z_{ijk}=1\) if cell \(i\) in sample \(j\) truly has type \(k\), and \(0\) otherwise. If \(P(Z_{ijk}=1\mid\text{annotation information})=q_{ijk}\), then linearity of expectation gives \(E(\sum_i Z_{ijk}\mid\text{annotation information})=\sum_i q_{ijk}\). Since \(n_j\) is fixed, the corresponding expected proportion is \(\sum_i q_{ijk}/n_j\). This derivation does not require the cell labels to be independent. Independence, or an explicit dependence model, is needed to calculate the variance of a sum of label indicators; in the independent binary case, that variance is \(\sum_i q_{ijk}(1-q_{ijk})\).

A sensitivity analysis should preserve the original experimental design and covariate adjustment. If the original analysis compares donor-level proportions while accounting for pairing or other sample-level structure, each reassignment should be analyzed with that same structure. Changing both the annotation and the analysis method at once makes it difficult to tell what caused a changed result.

Worked Example: Binary Target Versus Non-Target Labels

Suppose two hypothetical samples each contain five cells. For this example only, annotation is explicitly binary: each cell is either the target type or non-target. The target-type probabilities are \(0.90, 0.80, 0.55, 0.35, 0.20\) in the control sample and \(0.70, 0.60, 0.45, 0.25, 0.10\) in the treated sample. Compare probability-weighted proportions with hard labels, using a target label when its probability exceeds 0.50.

For control, the expected target count is \(0.90+0.80+0.55+0.35+0.20=2.80\). Its weighted proportion is \(2.80/5=0.560\). The hard-label count is three, because the first three target probabilities exceed 0.50, so the hard-label proportion is \(3/5=0.600\).

For treatment, the expected count is \(0.70+0.60+0.45+0.25+0.10=2.10\), and the weighted proportion is \(2.10/5=0.420\). The hard-label count is two, giving a hard-label proportion of \(2/5=0.400\). Defining the contrast as treated minus control, the weighted contrast is \(0.420-0.560=-0.140\), while the hard-label contrast is \(0.400-0.600=-0.200\). Both approaches indicate a lower target-type proportion in treatment in these two samples, but the estimated difference is larger with hard labels. With only one sample per condition, these numbers illustrate annotation sensitivity; they do not establish a population-level condition effect.

Multicategory Labels Require the Full Probability Vector

With more than two cell types, a target probability below 0.50 can still be the largest probability for that cell. For instance, a vector \((0.45,0.35,0.20)\) gives the target type the largest probability even though that probability is less than one-half. A hard assignment based on the most probable type must compare all entries in the vector. A cutoff on the target probability is a different decision rule and should be identified as such.

Worked Example: Comparing Full Multicategory Probabilities

Consider a hypothetical target type and two other types, B and C. The four cells in each sample have the following probability vectors, always ordered as target, B, C:

Control: \((0.45,0.35,0.20)\), \((0.40,0.32,0.28)\), \((0.20,0.55,0.25)\), and \((0.15,0.25,0.60)\). Treatment: \((0.38,0.34,0.28)\), \((0.30,0.42,0.28)\), \((0.25,0.40,0.35)\), and \((0.12,0.23,0.65)\). Every vector sums to one.

The control expected target count is \(0.45+0.40+0.20+0.15=1.20\), so its expected target proportion is \(1.20/4=0.300\). Under maximum-probability hard assignment, the first two cells are target cells: their target probabilities are the largest entries in their respective vectors. The last two cells are assigned to B and C, respectively. Thus the hard-label target proportion is \(2/4=0.500\).

The treatment expected target count is \(0.38+0.30+0.25+0.12=1.05\), giving a weighted proportion of \(1.05/4=0.2625\). Only the first treatment cell has the target as its largest probability, so the hard-label proportion is \(1/4=0.250\). The treatment-minus-control contrast is \(0.2625-0.300=-0.0375\) for weighted labels and \(0.250-0.500=-0.250\) for hard labels. The direction agrees, but the hard-label contrast is much larger in magnitude. In particular, the first control and first treatment cells are correctly counted as target under maximum-probability assignment despite having target probabilities below 0.50.

Reassignment, Refitting, and Evidence

A contrast should be recalculated under each plausible annotation scenario. A scenario may be a specified alternative set of hard labels, a changed decision rule, or one draw of labels from the full probability vectors. For each scenario, recalculate sample-level counts or proportions and refit the same condition model. Record the contrast estimate and its uncertainty or test statistic using that model. The purpose is to see whether the substantive conclusion depends on annotation, not to select whichever scenario gives the preferred result.

For a simple illustration of test strength, suppose an analysis uses independent donor-level proportions in two conditions and a two-sided Welch \(t\)-test. This procedure assumes independent donors within and across conditions, and uses an approximate \(t\) reference distribution for the difference in sample means; with very few donors, that approximation and the resulting evidence can be unstable. In a real study, the analysis should reflect its design, including pairing or covariates where appropriate. The following calculation compares annotation scenarios under the same illustrative test, rather than recommending it as a universal abundance model.

Worked Example: A Changed Direction Across Annotation Scenarios

Suppose a hypothetical study has three independent donors per condition. After probability-weighted counting, the donor-level target proportions are \(0.20, 0.24, 0.28\) in control and \(0.25, 0.29, 0.33\) in treatment. Under a plausible hard-label reassignment, the proportions are \(0.15, 0.25, 0.35\) in control and \(0.10, 0.20, 0.30\) in treatment. Compare treated-minus-control contrasts using the same Welch test.

For the weighted proportions, the means are \(\bar{x}_{C}=0.24\) and \(\bar{x}_{T}=0.29\), so the contrast is \(0.29-0.24=0.050\). In each condition the sample standard deviation is \(0.040\): for control, \(s_C=\sqrt{[(-0.04)^2+0^2+(0.04)^2]/2}=0.040\), and the treatment values have the same deviations from their mean. The standard error is

$$ SE=\sqrt{\frac{s_C^2}{3}+\frac{s_T^2}{3}} =\sqrt{\frac{0.040^2}{3}+\frac{0.040^2}{3}} =0.03266. $$

Thus \(t=0.050/0.03266=1.531\), with Welch degrees of freedom \(df=4\) here because the two sample variances and sample sizes are equal. The two-sided \(p\)-value is approximately \(0.20\).

For the hard-label proportions, the means are \(0.25\) in control and \(0.20\) in treatment, so the contrast is \(0.20-0.25=-0.050\). Each sample standard deviation is \(0.100\), giving \(SE=\sqrt{0.100^2/3+0.100^2/3}=0.08165\). The test statistic is \(t=-0.050/0.08165=-0.612\), again with \(df=4\), and the two-sided \(p\)-value is approximately \(0.57\). The estimated direction reverses, and the absolute test statistic is smaller under this hard-label scenario. Neither illustrative test provides strong evidence against a zero contrast. More importantly, the disagreement shows that the direction is not robust to this plausible annotation change; the small number of donors also makes both estimates and tests uncertain.

Diagnostics, Alternatives, and Limitations

Useful diagnostics begin with the label probabilities themselves. Inspect how many cells have a clear leading label, how many are close competitors, and whether uncertain cells are concentrated in particular samples or conditions. If one condition has systematically more ambiguous annotations, a condition contrast can partly reflect differential classification rather than a biological abundance shift. When reference labels are available, assess whether reported probabilities are reasonably calibrated and whether errors differ across conditions. Also verify that all cell-type probability vectors sum to one and that the same cell universe and sample denominators are used in each scenario.

Compare approaches according to the question and assumptions they address:

ApproachWhat it representsMain caution
Hard labelsOne chosen type for each cellDiscards uncertainty and can be sensitive to classification boundaries.
Probability-weighted proportionsExpected counts given the supplied cell-level probabilitiesDoes not by itself propagate uncertainty in those probabilities into the abundance model.
Repeated plausible label drawsVariation in contrasts across alternative cell assignmentsRequires defensible probabilities or reassignment scenarios; draws must respect relevant dependence.
Joint model of labels and abundanceUncertainty in labels and abundance parameters modeled togetherRequires a correctly specified, identifiable model and more modeling assumptions.

Repeated draws can show whether an effect’s sign or magnitude is sensitive to annotation, but the spread across draws is not automatically a complete measure of inferential uncertainty. It reflects only the label uncertainty represented by the draw mechanism. It does not automatically include donor-to-donor sampling variation, classifier estimation error, or systematic misclassification. Do not treat the repeated draws as new independent biological samples, and do not average their \(p\)-values as if that produced a valid combined test. Inference should use a method that accounts for the relevant sources of uncertainty.

A further limitation is that probabilities may omit plausible alternatives or share errors across cells. If a classifier systematically confuses two types, independent cell-by-cell draws from its reported probabilities may understate uncertainty. Use coherent scenarios or a dependence model when that structure is important, and report which sources of uncertainty were varied. A sensitivity analysis cannot correct a biased annotation system merely by repeating its assignments.

Common pitfall: “The target probability is below 0.50, so the cell cannot receive the target label.” This is valid only for a binary target-versus-non-target classification with a 0.50 threshold. With multiple types, the target may be the largest entry even when it is below 0.50. Compare the entire probability vector for a maximum-probability hard label, or state clearly that a different threshold rule is being used.

A useful report states the original annotation rule, how uncertainty was represented, which sample-level model was held fixed, and how the contrast changed across scenarios. Emphasize whether the direction was stable, whether the estimated magnitude changed materially, and whether evidence weakened or strengthened. Robustness across the tested scenarios supports the conclusion only with respect to those scenarios; it does not establish that all annotation error has been ruled out.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. A binary target probability vector is \(0.8, 0.3, 0.6, 0.2\). What are the weighted target proportion and the hard-label proportion using a threshold above 0.50?
  2. For a three-type cell, the probability vector is \((0.42,0.39,0.19)\), with the target type listed first. What is its maximum-probability hard label, and why is a 0.50 rule inappropriate for determining that label?
  3. Why should a paired abundance analysis remain paired when labels are reassigned?
  4. Repeated label draws yield mostly positive contrasts. What does this say about annotation sensitivity, and what does it not establish?

Solutions. (1) The weighted proportion is \((0.8+0.3+0.6+0.2)/4=1.9/4=0.475\). Two probabilities exceed 0.50, so the hard-label proportion is \(2/4=0.500\). (2) The maximum-probability label is the target because \(0.42\) exceeds \(0.39\) and \(0.19\); a 0.50 cutoff would fail to identify the most probable type in this multicategory case. (3) Pairing is part of the experimental design and controls how within-pair information contributes to the condition contrast. Removing it would change the analysis as well as the labels, obscuring the source of any change. (4) Mostly positive contrasts indicate that the contrast direction is relatively stable across the labels represented by those draws. They do not establish a positive population effect or account automatically for biological sampling variation, classifier error, or unmodeled dependence.

Clinical Biostats