Learn R Programming

edgeR (version 3.10.5)

estimateTrendedDisp: Estimate Empirical Bayes Trended Dispersion Values

Description

Estimates trended dispersion values by an empirical Bayes method.

Usage

estimateTrendedDisp(object, method="bin.spline", df=5, span=2/3)

Arguments

object
object of class DGEList containing (at least) the elements counts (table of raw counts), group (factor indicating group), lib.size (numeric vector of library sizes) and pseudo.alt (numeric matrix of quantile-adjusted pseudocounts calculated under the alternative hypothesis of a true difference between groups; recommended to use the DGEList object provided as the output of estimateCommonDisp
method
method used to estimated the trended dispersions. Possible values are "spline", and "loess".
df
integer giving the degrees of freedom of the spline function if "spline" method is used, see ns in the splines package. Default is 5.
span
scalar, passed to loess to determine the amount of smoothing for the loess fit when "loess" method is used. Default is 2/3.

Value

An object of class DGEList with the same components as for estimateCommonDisp plus the trended dispersion estimates for each gene.

Details

This function takes the binned common dispersion and abundance, and fits a smooth curve through these binned values using either natural cubic splines or loess. From this smooth curve it predicts the dispersion value for each gene based on the gene's overall abundance. This results in estimates for the NB dispersion parameter which have a dependence on the overall expression level of the gene, and thus have an abundance-dependent trend.

See Also

estimateCommonDisp estimates a common value for the dispersion parameter for all genes - should generally be run before estimateTrendedDisp.

Examples

Run this code
ngenes <- 1000
nlib <- 4
log2cpm <- seq(from=0,to=16,length=ngenes)
lib.size <- 1e7
mu <- 2^log2cpm * lib.size * 1e-6
dispersion <- 1/sqrt(mu) + 0.1
counts <- rnbinom(ngenes*nlib, mu=mu, size=1/dispersion)
counts <- matrix(counts,ngenes,nlib)
y <- DGEList(counts,lib.size=rep(lib.size,nlib))
y <- estimateCommonDisp(y)
y <- estimateTrendedDisp(y)
y <- estimateTagwiseDisp(y)
plotBCV(y)

Run the code above in your browser using DataLab