sizeFactors
(or normalizationFactors)
and dispersion estimates. See DESeq for the GLM formula.
nbinomWaldTest(object, betaPrior = TRUE, betaPriorVar, 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.
Furthermore, the weighted upper quantile is calculated using the
wtd.quantile function from the Hmisc package. The weights are given by
$1/mu-bar + alpha_tr$ using the mean of
normalized counts and the trended dispersion fit. The weighting ensures
that large log fold changes with small sampling variance contribute the
most to the estimation of the width of the prior.
The prior variance for a factor level is the average over all contrasts
of all factor levels.
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 or unless there the design
contains 2 level factors and an interaction term.
This ensures that log2 fold changes will be independent of the choice
of base 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.
When interaction terms are present, the prior on log fold changes will only be used for the interaction terms (non-interaction log fold changes receive a wide prior variance of 1000).
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