estimateTrendedDisp: Estimate Empirical Bayes Trended Dispersion Values

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/estimateTrendedDisp.R

Description

Estimates trended dispersion values by an empirical Bayes method.

Usage

1
2
3
4
5
## S3 method for class 'DGEList'
estimateTrendedDisp(y, method="bin.spline", df=5, span=2/3, ...)
## Default S3 method:
estimateTrendedDisp(y, group=NULL, lib.size=NULL, AveLogCPM=NULL, 
            method="bin.spline", df=5, span=2/3, ...)

Arguments

y

matrix of counts or a DGEList object.

method

method used to estimated the trended dispersions. Possible values are "bin.spline", and "bin.loess".

df

integer giving the degrees of freedom of the spline function if "bin.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.

group

vector or factor giving the experimental group/condition for each library.

lib.size

numeric vector giving the total count (sequence depth) for each library.

AveLogCPM

numeric vector giving average log2 counts per million for each tag

...

other arguments that are not currently used.

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.

Value

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

Author(s)

Yunshun Chen and Gordon Smyth

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

hiraksarkar/edgeR_fork documentation built on Dec. 20, 2021, 3:52 p.m.