Modelcore
Negative binomial model for read counts
Also called negative binomial GLM for RNA-seq.
Model the count of a gene as negative binomial with a mean from a log-linear model of the design and a gene-wise dispersion.
The negative binomial model for read counts says that the count of gene in sample has a negative binomial distribution with mean and dispersion , so that . The mean is the size factor of the sample times the expression of the gene, and the log of the expression is a linear function of the design, as in a generalized linear model. The term is the Poisson noise of sampling reads, and the term is the extra variation between biological replicates. Robinson and Smyth (2007) used this model for tag counts, and it is the model of edgeR and DESeq2. It is the model behind differential expression analysis of RNA-seq counts; with few replicates the dispersion is estimated by dispersion shrinkage. The moderated t-statistic is the other main route: it works on log counts with a normal model instead of on the counts.
The machine
Data. A matrix of counts for genes and samples , and a design matrix with one row per sample and columns (an intercept, the condition, a batch, and so on). The counts are the raw numbers of reads or fragments assigned to the gene, not normalized values.
Distribution. Given the parameters, the counts are independent and
With this is the negative binomial law with size and success probability .
Mean. , with . The size factors come from library size normalization and are fixed, so is an offset. The coefficients are log2 fold changes: for a design with an intercept and a 0 or 1 indicator of the treatment, is the log2 ratio of the expression in the treated group to that in the control group.
Dispersion. is the same for all samples of a gene. It has no unit. Its square root is the biological coefficient of variation (BCV): the coefficient of variation that the true expression would have between replicates if the depth were infinite.
Standing assumptions. The samples are independent. The design captures every systematic difference between them. The size factors are known. The dispersion does not depend on the condition. The model does not describe reads that map to many genes, and it does not by itself model excess zeros.
The gamma-Poisson mixture. The model is what one gets from two stages. The true expression of the gene in the sample is , with mean and variance . Given , the count is Poisson with mean . Integrating over gives the negative binomial law above.
What it counts
The model gives the probability of each count, and so a likelihood for the parameters of each gene:
From it come the maximum likelihood estimates , their standard errors, the Wald test of DESeq2 and the likelihood ratio test of a reduced design. It also predicts the spread of counts: the squared coefficient of variation of a count is
the sum of a technical part that falls with depth and a biological part that does not.
A worked case. For and , the variance is and the standard deviation is 33.2, against 10 for a Poisson count with the same mean. The BCV is , so the true expression varies by about 32 percent between replicates. Sequencing ten times as deeply, with , lowers the squared coefficient of variation only from 0.11 to 0.101. More replicates help; more depth beyond this point helps little.
Small values by hand. For and , the size is and the success probability is , so : , , . The Poisson law with mean 2 gives . The negative binomial law puts more mass at 0 and in the tail.
Relation to other models
- Poisson distribution. The case . Counts from technical replicates of the same library are close to Poisson. Biological replicates are not, and a Poisson test on them finds far too many changes.
- Generalized linear model. For a fixed , the negative binomial law is an exponential family in , so the model is a GLM with a log link and an offset, and it is fitted by iteratively reweighted least squares. The log link is not the canonical link of this family.
- Normal model on log counts. limma-voom models counts per million as normal, with precision weights from the trend of the variance against the mean, and then uses the moderated t-statistic. In published benchmarks the two routes give similar results; voom is faster and allows the tools of linear models.
- Quasi-likelihood. edgeR also fits a quasi-negative binomial model, in which a second, gene-wise factor multiplies the variance and is shrunk by empirical Bayes. Its tests keep the error rate closer to the nominal level when the dispersion is uncertain.
- Zero-inflated models. For single-cell data, some authors add a point mass at 0. For UMI counts, several studies report that the plain negative binomial model fits well without it. This is a measurement on data, not a result of the model.
- Beta-binomial model. For counts of two kinds of reads at one site, such as allele-specific expression, the analogue of the gamma-Poisson mixture is a beta-binomial mixture.
Known results in the model
Mean and variance. and .
Proof. With gamma and Poisson, . By the law of total variance, .
Concave in the coefficients. For a fixed , is a concave function of . If has full column rank and , it is strictly concave, so any stationary point is the unique maximum.
Proof. Write , which is affine in . As a function of , the term of sample is plus a constant. Its second derivative is . A concave function of an affine map is concave, and a sum of concave functions is concave. With full column rank, the Hessian , with diagonal and positive, is negative definite.
So IRLS, which is Fisher scoring for this model, has only one maximum to find. It can still fail to converge without step control when some counts are 0 and goes to infinity, as when a gene has no reads in one group.
Fisher information. For a fixed , the expected information for (in natural log units) is with .
Proof. The score of is . Its variance is . The chain rule through the affine map gives , times for log2 units.
The weight tends to as grows: beyond a certain depth a sample gives no more information about the fold change, because the biological variation dominates. This is the formal form of the worked case above.
Two groups with equal size factors. If all are equal to and the design is one mean per group, the maximum likelihood estimate of the mean of a group is , the mean count of the group divided by , for any fixed . This follows by setting the score to 0. With unequal size factors there is no closed form, and IRLS is used.
Exact test. For two groups with equal library sizes and a known , the sum of the counts of a group of samples is negative binomial with mean and size . Robinson and Smyth (2008) build an exact test from the conditional law of one group's sum given the total. It removes the unknown common mean by conditioning, in the same way as the Fisher exact test conditions on the margins of a table. edgeR uses it after it adjusts the counts to equal library sizes.
Estimating the dispersion. The maximum likelihood estimate of is biased downward with few replicates, because it ignores the degrees of freedom used by . The Cox-Reid adjusted profile likelihood, used by edgeR and DESeq2, corrects for this (McCarthy, Chen and Smyth 2012). With 2 or 3 replicates per group, a gene-wise estimate is still very noisy, which is why dispersion shrinkage borrows information across genes.
References
- Mark D. Robinson and Gordon K. Smyth, Moderated statistical tests for assessing differences in tag abundance, Bioinformatics 23(21) (2007), pages 2881 to 2887, the negative binomial model for tag counts with the variance mu + phi mu^2, and the weighted likelihood that moderates the dispersion
- Mark D. Robinson and Gordon K. Smyth, Small-sample estimation of negative binomial dispersion, with applications to SAGE data, Biostatistics 9(2) (2008), pages 321 to 332, the conditional maximum likelihood estimate of the dispersion and the exact test for two groups
- Simon Anders and Wolfgang Huber, Differential expression analysis for sequence count data, Genome Biology 11(10) (2010), article R106, the negative binomial model with size factors and a variance that is a smooth function of the mean
- Davis J. McCarthy, Yunshun Chen and Gordon K. Smyth, Differential expression analysis of multifactor RNA-Seq experiments with respect to biological variation, Nucleic Acids Research 40(10) (2012), pages 4288 to 4297, the negative binomial GLM with a design matrix and offsets, the biological coefficient of variation, and the Cox-Reid adjusted profile likelihood for the dispersion
- Michael I. Love, Wolfgang Huber and Simon Anders, Moderated estimation of fold change and dispersion for RNA-seq data with DESeq2, Genome Biology 15(12) (2014), article 550, the model K_ij ~ NB(mu_ij, alpha_i) with mu_ij = s_j q_ij and log2 q_ij = x_j beta_i, and the Wald test
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag 2AJH92 Edit this page History Report an error Markdown