sizeFactors
(or normalizationFactors
)
and dispersion estimates. See DESeq
for the GLM formula.
nbinomWaldTest(object, betaPrior, betaPriorVar, modelMatrix = NULL, modelMatrixType, maxit = 100, useOptim = TRUE, quiet = FALSE, useT = FALSE, df, useQR = TRUE)
DESeq
, is
formed. "standard" is as created by model.matrix
using the
design formula. "expanded" includes an indicator variable for each
level of factors in addition to an intercept.
betaPrior must be set to TRUE in order for expanded model matrices
to be fit.results
function. The coefficients and standard errors are
reported on a log2 scale.
The prior variance is calculated by matching the 0.05 upper quantile
of the observed MLE coefficients to a zero-centered Normal distribution.
In a change of methods since the 2014 paper,
the weighted upper quantile is calculated using the
wtd.quantile
function from the Hmisc package. The weights are
the inverse of the expected variance of log counts, so the inverse of
$1/mu-bar + alpha_tr$ using the mean of
normalized counts and the trended dispersion fit. The weighting ensures
that noisy estimates of log fold changes from small count genes do not
overly influence the calculation of the prior variance.
See estimateBetaPriorVar
.
The final prior variance for a factor level is the average of the
estimated prior variance over all contrasts of all levels of the factor.
Another change since the 2014 paper: when interaction terms are present
in the design, the prior on log fold changes is turned off
(for more details, see the vignette section, "Methods changes since
the 2014 DESeq2 paper").
When a log2 fold change prior is used (betaPrior=TRUE),
then nbinomWaldTest
will by default use expanded model matrices,
as described in the modelMatrixType
argument, unless this argument
is used to override the default behavior.
This ensures that log2 fold changes will be independent of the choice
of reference level. In this case, the beta prior variance for each factor
is calculated as the average of the mean squared maximum likelihood
estimates for each level and every possible contrast. The results
function without any arguments will automatically perform a contrast of the
last level of the last variable in the design formula over the first level.
The contrast
argument of the results
function can be used
to generate other comparisons.
The Wald test can be replaced with the nbinomLRT
for an alternative test of significance.
DESeq
, nbinomLRT
dds <- makeExampleDESeqDataSet()
dds <- estimateSizeFactors(dds)
dds <- estimateDispersions(dds)
dds <- nbinomWaldTest(dds)
res <- results(dds)
Run the code above in your browser using DataLab