nbinomLRT {DESeq2}R Documentation

Likelihood ratio test (chi-squared test) for GLMs

Description

This function tests for significance of change in deviance between a full and reduced model which are provided as formula. Fitting uses previously calculated sizeFactors (or normalizationFactors) and dispersion estimates.

Usage

nbinomLRT(object, full = design(object), reduced, betaPrior = FALSE,
  betaPriorVar, modelMatrixType, maxit = 100, useOptim = TRUE,
  quiet = FALSE, useQR = TRUE, betaPriorUpperQuantile = 0.05)

Arguments

object

a DESeqDataSet

full

the full model formula, this should be the formula in design(object)

reduced

a reduced formula to compare against, e.g. the full model with a term or terms of interest removed

betaPrior

whether or not to put a zero-mean normal prior on the non-intercept coefficients (Tikhonov/ridge regularization). While the beta prior is used typically, for the Wald test, it can also be specified for the likelihood ratio test. For more details on the calculation, see nbinomWaldTest.

betaPriorVar

a vector with length equal to the number of model terms including the intercept. which if missing is estimated from the rows which do not have any zeros

modelMatrixType

either "standard" or "expanded", which describe how the model matrix, X of the formula in DESeq, is formed. "standard" is as created by model.matrix using the design formula. "expanded" includes an indicator variable for each level of factors with 3 or more levels in addition to an intercept, in order to ensure that the log2 fold changes are independent of the choice of base level. betaPrior must be set to TRUE in order for expanded model matrices to be fit.

maxit

the maximum number of iterations to allow for convergence of the coefficient vector

useOptim

whether to use the native optim function on rows which do not converge within maxit

quiet

whether to print messages at each step

useQR

whether to use the QR decomposition on the design matrix X while fitting the GLM

betaPriorUpperQuantile

only used when betaPrior=TRUE, which is not the default. the upper quantile to use for calculating the variance of the beta prior. by default the 0.05 upper quantile of the absolute value of the MLE betas is matched to the 0.025 upper quantile of a zero-centered normal.

Details

The difference in deviance is compared to a chi-squared distribution with df = (reduced residual degrees of freedom - full residual degrees of freedom). This function is comparable to the nbinomGLMTest of the previous version of DESeq and an alternative to the default nbinomWaldTest.

Value

a DESeqDataSet with new results columns accessible with the results function. The coefficients and standard errors are reported on a log2 scale.

See Also

DESeq, nbinomWaldTest

Examples

dds <- makeExampleDESeqDataSet()
dds <- estimateSizeFactors(dds)
dds <- estimateDispersions(dds)
dds <- nbinomLRT(dds, reduced = ~ 1)
res <- results(dds)

[Package DESeq2 version 1.4.5 Index]