Why Use a Negative Binomial Model for Pseudobulk Counts?
Pseudobulk analysis sums cell-level counts within a biological sample and cell type, producing a count for each gene in each sample. These counts are nonnegative integers, but their variability across biological samples is often greater than a Poisson model allows. A negative binomial generalized linear model (GLM) accommodates that extra variability while relating each gene’s expected count to the experimental design.
The observational units for the model are the pseudobulk samples, not the individual cells that contributed to each sum. Thus, the rows of the model correspond to biological samples (or to the relevant sample-level observations), and the response for a given gene is its pseudobulk count across those rows. The model does not make the cells within a sample into independent biological replicates.
The mean and dispersion describe different features. The mean sets the expected count for a sample under the model; dispersion determines how much variability there is around that mean beyond ordinary Poisson sampling variation. A gene can have a large expected count and low relative extra variation, or a modest expected count and substantial extra variation. Dispersion is not the same as the standard deviation: the model-implied standard deviation is \(\sqrt{\mu_{ig}+\alpha_g\mu_{ig}^{2}}\).
Specifying the Gene-Wise GLM
Let \(X\) be the design matrix, with one row per pseudobulk sample and columns encoding the predictors in the experimental design. For gene \(g\), let \(\boldsymbol{\beta}_g\) be its coefficient vector, and let \(\mathbf{x}_i^{T}\) be row \(i\) of \(X\). A basic negative binomial GLM uses a log link:
The linear predictor \(\eta_{ig}\) is the design-row weighted sum of coefficients. Exponentiating it gives the fitted mean count, \(\mu_{ig}=\exp(\eta_{ig})\), which is necessarily positive. The coefficients and design columns are gene-specific in their effects: a condition or covariate can have a different relationship with expected count for each gene.
For example, with an intercept and a binary condition indicator \(T_i\), the design row is \(\mathbf{x}_i^T=(1,T_i)\), and the predictor is \(\eta_{ig}=\beta_{0g}+\beta_{1g}T_i\). When \(T_i=0\), the mean is \(\exp(\beta_{0g})\); when \(T_i=1\), it is \(\exp(\beta_{0g}+\beta_{1g})\). This illustrates how the design matrix maps the experimental groups to mean counts. The choice and interpretation of design columns follow the study design; this model specification does not by itself determine a testing procedure.
The equation above is the basic specification without an exposure or library-size offset. It is appropriate as written only when the mean structure is suitable for the count scale being modeled—for example, when relevant exposure differences are absent or have otherwise been addressed. In practical pseudobulk analyses, library sizes can differ substantially; incorporating an offset is a separate part of the model specification. A model without a needed adjustment can mistake differences in sequencing depth for differences in gene expression.
Worked Example: From Design Row to Expected Count
Suppose a hypothetical gene is modeled for control and treated pseudobulk samples using \(T_i=0\) for control and \(T_i=1\) for treated. Let \(\beta_{0g}=\log(8)\) and \(\beta_{1g}=\log(1.5)\). These are stipulated model coefficients, not estimates from a data set.
For a control sample, the design row is \((1,0)\), so \(\eta_{ig}=1\log(8)+0\log(1.5)=\log(8)\). Therefore the expected count is \(\mu_{ig}=\exp(\log(8))=8\) counts.
For a treated sample, the row is \((1,1)\), so \(\eta_{ig}=\log(8)+\log(1.5)=\log(12)\). The expected count is \(\mu_{ig}=\exp(\log(12))=12\) counts. The calculation shows how the coefficient and design indicator combine on the log-mean scale to produce a mean on the count scale.
This specification alone does not say that the observed count in each sample will equal its expected count. It describes a distribution of possible counts around the mean, and that distribution also depends on the dispersion.
What the Dispersion Does
One useful representation of the negative binomial distribution is a Poisson model with a sample-specific latent rate that varies across a gamma distribution. Conditional on a latent rate \(\Lambda_{ig}\), let \(Y_{ig}\mid\Lambda_{ig}\sim\operatorname{Poisson}(\Lambda_{ig})\), and let \(\Lambda_{ig}\sim\operatorname{Gamma}(1/\alpha_g,\alpha_g\mu_{ig})\), using shape and scale parameters. This mixture gives the negative binomial variance.
This mixture is a useful explanation of the distribution, not a claim that a particular biological mechanism must generate the variation. In the GLM, the dispersion describes the chosen count distribution’s mean–variance relationship. It does not, by itself, identify the source of excess variability or remove dependence among repeated measurements from the same donor.
Worked Example: Calculating the Model-Implied Variance
For a hypothetical gene and sample, suppose the model mean is \(\mu_{ig}=12\) counts and the dispersion is \(\alpha_g=0.20\). Under the negative binomial variance function,
The model-implied standard deviation is \(\sqrt{40.8}=6.387\) counts. A Poisson model with the same mean would instead have variance \(12\ \text{counts}^{2}\) and standard deviation \(\sqrt{12}=3.464\) counts. Thus, \(\alpha_g=0.20\) produces appreciably more variability than the Poisson model at this mean.
The variance is larger than the mean, but it is not correct to interpret the numerical value \(0.20\) as a 20% increase in variance. The extra term is \(\alpha_g\mu_{ig}^{2}\), so the effect of a given dispersion depends on the mean.
Distributional Assumptions and a Probability Calculation
For clarity, a common parameterization sets \(r=1/\alpha_g\) when \(\alpha_g>0\). Under that parameterization, the probability of observing a count \(y\) is
This form has mean \(\mu_{ig}\) and variance \(\mu_{ig}+\alpha_g\mu_{ig}^{2}\). In particular, setting \(y=0\) gives \(P(Y_{ig}=0)=(1+\alpha_g\mu_{ig})^{-1/\alpha_g}\). This can help assess whether a specified mean and dispersion allow plausible zero counts, although a zero frequency alone is not a complete model check.
Worked Example: Probability of a Zero Count
Suppose a hypothetical model assigns a gene a mean of \(\mu_{ig}=5\) counts and dispersion \(\alpha_g=0.40\) in a pseudobulk sample. The negative binomial zero-count probability is
Under a Poisson model with mean 5, the corresponding probability would be \(e^{-5}\approx0.006738\). The negative binomial model assigns a larger probability to a zero at these specified parameters because its extra variation places more probability in both tails. These calculations compare two assumed distributions; they do not establish which distribution fits actual samples better.
The basic gene-wise model relies on several conditions. The response values must be counts; the log-mean relationship must represent the systematic effects encoded in the design; and, conditional on the modeled predictors, sample-level observations must satisfy the assumed independence structure. The negative binomial variance function must also be an adequate description of variability. These are modeling assumptions, not consequences of aggregating cells.
If multiple pseudobulk observations come from the same donor, they may be correlated. Treating them as independent rows in an ordinary GLM can understate uncertainty. Donor-aware fixed- or random-effect structures may be needed for repeated or paired observations. Similarly, an omitted relevant sample-level predictor, severe design confounding, or an unmodeled library-size difference can make the fitted mean structure inadequate even if the negative binomial variance formula is flexible.
Diagnostics, Alternatives, and Limits
Diagnostics should evaluate both the mean and the distributional variation. Useful checks include comparing observed and fitted counts across samples, examining residual patterns against fitted means and design variables, and checking whether the frequency of zeros and large counts is broadly compatible with fitted distributions. Patterns of residuals by condition or batch can signal a missing mean effect; residual spread that systematically increases or decreases with the fitted mean can signal a poor variance specification. A small number of extreme counts can also have substantial influence and should be checked against the underlying sample and count-processing records.
The Poisson GLM is a simpler alternative, but it assumes \(\operatorname{Var}(Y_{ig})=\mu_{ig}\). If biological samples vary more than this assumption permits, Poisson-based uncertainty can be too small. A negative binomial GLM relaxes that restriction using \(\alpha_g\). Conversely, the negative binomial model is not automatically correct merely because it permits extra-Poisson variation: it can still fail if the mean is misspecified, observations are dependent, or the assumed distribution does not describe the data adequately.
A further practical limitation is that gene-specific dispersion can be difficult to estimate reliably when there are few biological replicates. The model’s definition specifies the role of dispersion but does not solve the estimation problem. Nor does a gene-wise GLM alone address multiplicity across genes, select a scientifically meaningful contrast, or establish causal effects. Those questions require additional design and inferential choices.
The key modeling sequence is to define the sample-level response, encode the design in \(X\), specify the expected count through the log link, and state the dispersion-dependent variance. Every fitted mean and uncertainty calculation depends on these choices being compatible with the biological replication and sample structure.
Check Your Understanding
Answer each question using the negative binomial GLM specified above. Complete solutions follow the questions.
- If \(\mu_{ig}=10\) counts and \(\alpha_g=0.10\), what are the model-implied variance and standard deviation?
- With a log link, an intercept of \(\log(4)\) and a binary condition coefficient of \(\log(2)\), what are the expected counts for the reference and condition groups?
- What assumption is violated if two rows represent repeated measurements from the same donor but are treated as independent observations?
- Why does using a negative binomial rather than Poisson distribution not automatically correct for a library-size difference?
Solutions. (1) The variance is \(10+0.10(10^2)=20\ \text{counts}^{2}\), and the standard deviation is \(\sqrt{20}=4.472\) counts. (2) The reference mean is \(\exp(\log(4))=4\) counts; the condition mean is \(\exp(\log(4)+\log(2))=8\) counts. (3) Conditional independence across rows is violated because observations from one donor can be correlated. A model must reflect the repeated-measure structure rather than count those rows as independent biological replicates. (4) The negative binomial dispersion changes the variance around the modeled mean; it does not adjust the mean for exposure or sequencing depth. If library sizes differ in a way relevant to expected counts, the mean specification needs an appropriate adjustment.