estimateGLMTrendedDisp {edgeR} | R Documentation

## Estimate Trended Dispersion for Negative Binomial GLMs

### Description

Estimates the abundance-dispersion trend by Cox-Reid approximate profile likelihood.

### Usage

    ## S3 method for class 'DGEList'
    estimateGLMTrendedDisp(y, design=NULL, method="auto", ...)
    ## Default S3 method:
    estimateGLMTrendedDisp(y, design=NULL, offset=NULL, AveLogCPM=NULL,
                           method="auto", weights=NULL, ...)

### Arguments

`y` | a matrix of counts or a `DGEList` object.)
`design` | numeric design matrix, as for `glmFit`.
`method` | method (low-level function) used to estimated the trended dispersions. Possible values are `"auto"` (default, switch to `"bin.spline"` method if the number of genes is great than 200 and `"power"` method otherwise),`"bin.spline"`, `"bin.loess"` (which both result in a call to `dispBinTrend`), `"power"` (call to `dispCoxReidPowerTrend`), or `"spline"` (call to `dispCoxReidSplineTrend`).
`offset` | numeric scalar, vector or matrix giving the linear model offsets, as for `glmFit`.
`AveLogCPM` | numeric vector giving average log2 counts per million for each gene.
`weights` | optional numeric matrix giving observation weights
`...` | other arguments are passed to lower-level functions `dispBinTrend`, `dispCoxReidPowerTrend` or `dispCoxReidSplineTrend`.

### Details

Estimates the dispersion parameter for each gene with a trend that depends on the overall level of expression for that gene. This is done for a DGE dataset for general experimental designs by using Cox-Reid approximate conditional inference for a negative binomial generalized linear model for each gene with the unadjusted counts and design matrix provided.

The function provides an object-orientated interface to lower-level functions.

### Value

When the input object is a `DGEList`, `estimateGLMTrendedDisp` produces a `DGEList` object, which contains the estimates of the trended dispersion parameter for the negative binomial model according to the method applied.

When the input object is a numeric matrix, it returns a vector of trended dispersion estimates calculated by one of the lower-level functions `dispBinTrend`, `dispCoxReidPowerTrend` and `dispCoxReidSplineTrend`.

### Author(s)

Gordon Smyth, Davis McCarthy, Yunshun Chen

### References

Cox, DR, and Reid, N (1987). Parameter orthogonality and approximate conditional inference. Journal of the Royal Statistical Society Series B 49, 1-39.

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. http://nar.oxfordjournals.org/content/40/10/4288

### See Also

`dispBinTrend`, `dispCoxReidPowerTrend` and `dispCoxReidSplineTrend` for details on how the calculations are done.

### Examples

    ngenes <- 250
    nlibs <- 4
    y <- matrix(rnbinom(ngenes*nlibs,mu=10,size=10),ngenes,nlibs)
    d <- DGEList(counts=y,group=c(1,1,2,2),lib.size=c(1000:1003))
    design <- model.matrix(~group, data=d$samples)
    disp <- estimateGLMTrendedDisp(d, design, min.n=25, df=3)
    plotBCV(disp)

[Package edgeR version 3.22.5 Index]