This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How dispersion is used in EdgeR

To my knowledge, coefficient of regression beta and dispersion parameter alpha can be estimated with maximum likelihood estimation but in edgeR, the dispersion is estimated using the whole set of data with empirical Bayes.

  1. As I know, empirical Bayes is to estimate the parameters of prior distribution(gamma distribution in this case) of the parameter we want to know. It seems that the parameter we want to know is pi(fraction of cDNA fragments) since the Total Law of Variance is about (y|pi). Is it right? In the document it says 'true gene abundances follow gamma distribution', so we assume pi also follows gamma?. If that's the case, is dispersion somewhat related to the parameter of gamma distribution of pi?

  2. Also, While the main purpose of edgeR is to test hypothesis about coefficient beta, I'm not sure where dispersion comes in apart from the visualization of plots to justify the use of negative binomial regression. Since coefficient of regression beta can be estimated with likelihood, dispersion is not used in finding the regression line is it?

I'm sorry that I have a weak basis in statistics. Could someone correct me?

edger regression binomial negative dispersion

Have you read the most recent edgeR paper at https://doi.org/10.1093/nar/gkaf018, which gives a summary of the statistical methods in edgeR?

There is no parameter in edgeR called "alpha", so I wonder what you are reading.

Yes, the negative binomial dispersion parameter in edgeR is the squared CV of the gamma distribution.

The negative binomial dispersion does affect the regression estimates.

Maximum likelihood produces biased and highly uncertain dispersion estimates. It is completely unsuitable for dispersion estimation of omics data with small to moderate sample sizes.

edgeR versions 3 and 4 have moved to use global estimates of the negative binomial dispersion in favour of empirical Bayes quasi-dispersion estimation. See the summary in the above paper.

The edgeR User's Guide is primarily intended to guide users of the software, so it only gives a very brief summary of the mathematics behind edgeR. Details of the mathematics are more the domain of the published journal articles. Regression estimation in edgeR follows standard generalized linear model theory for the negative binomial family, so a textbook on glms would be relevant.

2 answers

edgeR incorporates a great deal of advanced and novel statistical theory but it is based on generalized linear models (GLMs). GLMs are based on the idea of a variance function, which determines the mean-variance relationship of the response variable. If you have a good understanding of GLM theory, then you should be able to appreciate how edgeR's negative binomial (NB) dispersions enter into the regression coefficients and into the statistical tests. You don't need to know anything about NB GLMs specifically, because the principles and the estimation algorithm are the same for all GLMs. If you know GLM theory in general, and you know the NB variance function in particular, then you should be to work the rest out.

Briefly speaking,

  1. the NB dispersion determines the variance function,
  2. the variance function divides into the GLM working weights,
  3. the working weights enter into the reweighted linear regressions that determine the GLM regression fit.

Furthermore, the NB dispersion enters directly into the NB likelihood function and into the residual deviances that determine the test statistics for the regression coefficients once the GLM fits are done.

Here are some relevant references relating to empirical Bayes and to GLMs (all of which are cited in the edgeR User's Guide and function help pages). Dunn & Smyth (2018) explain the theory of GLMs from scratch, and also briefly cover NB GLMs in particular. If you don't already understand GLMs, then you are always going to have trouble understanding edgeR, because it is a very advanced tool that uses GLMs as the starting point.

Unbiased estimation of the NB dispersion (why MLE is wrong):

Robinson MD, Smyth GK (2008). Small sample estimation of negative binomial dispersion, with applications to SAGE data. Biostatistics 9, 321-332.

Empirical Bayes estimation of the NB dispersion using conditional likelihood (edgeR v1):

Robinson MD, Smyth GK (2007). Moderated statistical tests for assessing differences in tag abundance. Bioinformatics 23, 2881-2887.

Empirical Bayes estimation of the NB dispersion using generalized linear models (edgeR v2):

McCarthy DJ#, Chen Y#, Smyth GK (2012). Differential expression analysis of multifactor RNA-Seq experiments with respect to biological variation. Nucleic Acids Research 40, 4288-4297.

Empirical Bayes estimation of the NB quasi-dispersion (edgeR v3):

Lund SP, Nettleton D, McCarthy DJ, Smyth GK (2012). Detecting differential expression in RNA-sequence data using quasi-likelihood with shrunken dispersion estimates. Statistical Applications in Genetics and Molecular Biology Volume 11, Issue 5, Article 8.

Negative binomial generalized linear models:

Dunn PK, Smyth GK (2018). Generalized linear models with examples in R. Springer, New York, NY. doi:10.1007/978-1-4419-0118-7.

My statistics is possibly not quite up to this, but I could well be the best you'll get unless and until Gordon Smyth comes round and tells me what i've got wrong, which he does from time to time (I mean comes around, not tells me i'm wrong).

Question 1:

As I know, empirical Bayes is to estimate the parameters of prior distribution(gamma distribution in this case) of parameter theta. It seems that the parameter theta is phi(fraction of cDNA fragments) since the Total Law of Variance is about (y|phi). Is it right? In the document it says 'true gene abundances follow gamma distribution', so we assume phi also follows gamma?. If that's the case, is dispersion the parameter of gamma distribution of phi?

Dispersion IS phi, not the parameter of its distribution.

In this article, we call phi_g the dispersion and sqrt(phi_g) the biological CV although, strictly speaking, it captures all sources of the inter-library variation between replicates

--(edgeR manual, page 18).

Question 2:

Since coefficient of regression beta can be estimated with likelihood, dispersion is not used in finding the regression line is it?

You don't need disperison to calculate the betas of the regression, but you do need dispersion to understand the variance of your estimates of beta, and therefore to be able to test hypotheses about them.

Thank you for your answer.

Sorry for the ambiguity. What I meant was pi(fraction of cDNA fragments) not phi, so I changed it.

For the second question, I get that dispersion within group and between group is needed for tests like F tests.

However, if you know beta, and therefor the regression line, you could calculate the variance with the data right away can't you?

If so, Empirical bayes is used because usually the sample sizes are too small and noisy?

Okay, so if we are talking about pi, rather than phi, then pi is one realisation of a draw from the underlying distribution of gene expression. What we are really interested in is some underlying abstract gene expression propensity that is realised in a given sample as pi_gi. In a different replicate of the same condition, with the same undrelying gene expression propensity, it is going to be realised as a different fraction - pi_gi is different between different samples. It is improtant to realise that pi_ig is different between different samples not just because we measure it inaccurately, but because it is actaully different.

If that's the case, is dispersion somewhat related to the parameter of gamma distribution of pi?

Yes, just so. If I've done my algibra right, the disperision, phi, is 1/alpha where alpha is the shape parameter of the gamma distribution of pi * total_number_of_cDNAs.

If so, Empirical bayes is used because usually the sample sizes are too small and noisy?

Yes empriical bayes is used because most RNAseq experiments have only low single numbers of repeats per condition, and this is insufficient to get an accurate estimate for it from the replicates of one gene only.

You actually do need the negative binomial dispersion to estimate the betas of the regression, because it determines the mean-variance relationship of the data. It is rather the quasi-dispersion parameter that is not needed.

The subtlety here is that the negative binomial dispersion is not a "dispersion" parameter in the usual glm terminology, but is rather an unknown parameter in the variance function. On the other hand, edgeR's quasi-dispersion is the same as the glm concept of a dispersion parameter.

Thank you for the amazing tool and the reply.

I struggled to find a source for negative binomial regression by googling but it's all about how to run codes or how to estimate dispersion by moments or MLE or Empirical Bayes.

The only source I can find about how to determine the coefficient beta is this. https://www.ncss.com/wp-content/themes/ncss/pdf/Procedures/NCSS/Negative_Binomial_Regression.pdf

It just uses partial differentiation to determine beta and the dispersion parameter. I still can't understand where dispersion comes in when finding beta.

Could you give me a little bit more guidance?

I have responded your comment by posting a new answer.

Log in to answer this question.