Techniqueadvanced
Dispersion shrinkage
Also called empirical Bayes dispersion estimation.
Shrink each gene's dispersion estimate toward a trend over mean expression, to stabilize tests when there are few replicates.
Dispersion shrinkage is the technique of estimating the dispersion of each gene in a negative binomial model by combining the gene's own estimate with the estimates of all other genes. With two or three replicates per condition, the gene-wise estimate of the dispersion is very noisy. If a test uses it, genes whose dispersion is underestimated by chance give false positives, and genes whose dispersion is overestimated lose power. The technique fits a trend of the dispersion against the mean expression over all genes, treats the trend as the center of a prior, estimates the spread of the true dispersions around the trend, and moves each gene-wise estimate toward the trend by an amount that depends on how noisy it is. This is empirical Bayes in the sense of Robbins: the prior is estimated from the data of the many parallel problems. edgeR and DESeq2 use it. The moderated t-statistic of limma applies the same idea to the residual variances of a normal model.
In plain words
You have ten thousand genes, but only three samples per group. For each gene you want to know how much its counts vary between replicates. Three samples are too few to measure that well for one gene alone. But genes with similar expression levels tend to vary by similar amounts, and you have thousands of them. So you work out what a typical gene at each level looks like, and then pull each gene's own noisy value toward that typical value. You pull hard when the gene's own value is unreliable, and gently when there is enough data to trust it. A gene that is far more variable than the rest is left alone, because pulling it in would make it look more certain than it is.
When it applies
- Many parallel estimates. Thousands of genes, each with its own dispersion, measured in the same experiment.
- Few degrees of freedom per gene. The residual degrees of freedom , the number of samples less the number of coefficients, are small, often 2 to 10.
- A shared structure. The true dispersions are similar for genes of similar mean, so a smooth trend plus a spread describes them. Biologically, this holds roughly: low-count genes have larger dispersions, and the dispersion levels off at high counts.
- A test that depends on the dispersion. The Wald test and the likelihood ratio test of a negative binomial GLM both depend on through the variance of the counts.
It does not apply when each gene has many replicates; then the gene-wise estimate is good and shrinkage does little. It does not help when the dispersions do not follow a common pattern, for example when a few genes are hugely more variable for biological reasons.
The template
SHRINK-DISPERSIONS(K, X, s) ▷ counts, design, size factors- 1
for each gene g do - 2
α̂_g ← gene-wise estimate, maximizing the Cox-Reid adjusted profile likelihood - 3
fit a trend α_tr(μ̄) of α̂_g against the mean normalized count μ̄_g - 4
v ← observed variance of ln α̂_g - ln α_tr(μ̄_g); σ² ← v less its expected sampling variance - 5
for each gene g do - 6
α̃_g ← the maximizer of (adjusted log likelihood of α) + (log prior: ln α ~ N(ln α_tr(μ̄_g), σ²)) - 7
if ln α̂_g - ln α_tr(μ̄_g) > 2√v then α̃_g ← α̂_g ▷ dispersion outlier: do not shrink - 8
return α̃
Line L2 is the estimate of one gene alone. The Cox-Reid adjustment subtracts from the profile log likelihood, which removes most of the downward bias of the plain maximum likelihood estimate when coefficients are fitted from few samples. Line L3 fits the trend. DESeq2 fits by a gamma-family GLM of the gene-wise estimates, and edgeR fits a smooth curve. Line L4 estimates how widely the true dispersions spread around the trend: the observed spread of the log residuals includes sampling noise, and the expected sampling variance of is subtracted. Line L6 is the maximum a posteriori estimate. Its result lies between and the trend: close to the trend when is small or is small, and close to when is large. Line L7 follows DESeq2: a gene more than two standard deviations of the observed log residuals above the trend keeps its own estimate, so that shrinkage never makes a truly variable gene look stable.
How much to shrink. A normal approximation shows the weights. For a normal model, the estimate of a variance from degrees of freedom has , the trigamma function. Suppose behaves the same way, with . Then the posterior mode of is close to
Take , and . With , , the weights are 1.55 and 4, and : most of the way to the trend. With , , the weights are 9.5 and 4, and : closer to the gene's own value. This is an illustration with a normal approximation, not the exact DESeq2 computation.
Classic examples
- Moderated t-statistic. limma shrinks the residual variance of each gene toward a prior value with prior degrees of freedom , both estimated from all genes. There the prior is conjugate and the posterior has a closed form, and the null distribution of the resulting statistic is exactly with degrees of freedom. Dispersion shrinkage is the same idea for a negative binomial dispersion, where no conjugate form exists.
- edgeR weighted likelihood. Robinson and Smyth (2007) maximized the gene's likelihood plus a weight times the likelihood shared by all genes. McCarthy, Chen and Smyth (2012) replaced the common value by a trend over the mean, with the Cox-Reid adjusted profile likelihood for GLMs.
- DESeq2. Love, Huber and Anders (2014) put a log-normal prior around the fitted trend, estimated its variance from the genes, and took the maximum a posteriori dispersion, as in the template. DESeq2 shrinks the log fold changes as well, with a separate prior.
- The James-Stein estimator. For three or more normal means, shrinking all estimates toward a common point lowers the total squared error, whatever the true means are. Dispersion shrinkage has the same flavour, but it shrinks on the log scale toward a fitted trend, and its gain is measured in simulations rather than proved.
- DESeq. Anders and Huber (2010) fitted the variance as a smooth function of the mean and used the larger of the fitted and the gene-wise value. This is a conservative form of sharing information without a prior.
Variations
- Common dispersion. One value for all genes. It is the strongest shrinkage, and it is wrong when low-count genes have larger dispersions.
- Trended dispersion. The trend value alone, with no gene-wise part.
- Quasi-likelihood dispersion. edgeR's quasi-likelihood pipeline fixes the negative binomial dispersion at the trend and puts a second, gene-wise factor on the variance, which it shrinks as limma shrinks variances. Its tests use an F distribution with the prior degrees of freedom added.
- Robust priors. limma and edgeR offer robust estimation of the prior, so that a few outlying genes do not inflate or the prior degrees of freedom.
- Fold change shrinkage. The same empirical Bayes idea applied to instead of , used to rank genes by effect size. It is a separate step and does not change the test.
Pitfalls
- Shrinking an outlier. A gene with a true dispersion far above the trend, if shrunk, looks much more stable than it is, and gives a false positive. DESeq2 does not shrink such genes; other tools use robust priors.
- A poor trend. With few genes, or a strong dependence of the dispersion on something other than the mean (such as GC content), the trend is wrong, and so is the center of the prior. Plot , the trend and against the mean before trusting the tests.
- Differences between groups. The model has one dispersion per gene. When one condition is much more variable than the other, the shared value misstates both, and shrinkage cannot fix that.
- Treating the shrunk value as known. The tests use as if it were the true value. This ignores its uncertainty, which is one reason the quasi-likelihood F tests of edgeR hold their level better with very few replicates.
- Few genes. The prior variance in line L4 is a difference of two quantities and can be negative or unstable with few genes. Then it is set to a small positive floor, which amounts to strong shrinkage.
Exercises
- Show that, for a normal model with residual variance on degrees of freedom and the prior , the posterior mean of is . This is the formula of the moderated t-statistic.
- In the normal approximation above, find the number of degrees of freedom at which the gene-wise estimate and the trend get equal weight when , by solving .
- Explain why subtracting the expected sampling variance in line L4 is needed, by computing what would be if all genes had exactly the trend dispersion.
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 weighted likelihood that combines the likelihood of one gene with the common likelihood of all genes to moderate the dispersion
- 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 common, trended and gene-wise dispersions estimated by the Cox-Reid adjusted profile likelihood, with the gene-wise values shrunk toward the trend
- 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 trend of the dispersion over the mean, the log-normal prior around it with a variance estimated from the genes, the maximum a posteriori dispersion, and the handling of dispersion outliers
- Simon Anders and Wolfgang Huber, Differential expression analysis for sequence count data, Genome Biology 11(10) (2010), article R106, the variance modelled as a smooth function of the mean, and the use of the larger of the fitted and the gene-wise value
- Gordon K. Smyth, Linear models and empirical Bayes methods for assessing differential expression in microarray experiments, Statistical Applications in Genetics and Molecular Biology 3(1) (2004), Article 3, the same shrinkage for residual variances of a normal model, with a scaled inverse chi-squared prior estimated from all genes
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 | W3 standard |
|
Tag 20WZPC Edit this page History Report an error Markdown