Description Usage Arguments Details Value See Also Examples

This function tests for significance of coefficients in a Negative
Binomial GLM, using previously calculated `sizeFactors`

(or `normalizationFactors`

)
and dispersion estimates. See `DESeq`

for the GLM formula.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |

`object` |
a DESeqDataSet |

`betaPrior` |
whether or not to put a zero-mean normal prior on the non-intercept coefficients |

`betaPriorVar` |
a vector with length equal to the number of model terms including the intercept. betaPriorVar gives the variance of the prior on the sample betas on the log2 scale. if missing (default) this is estimated from the data |

`modelMatrix` |
an optional matrix, typically this is set to NULL and created within the function |

`modelMatrixType` |
either "standard" or "expanded", which describe
how the model matrix, X of the formula in |

`betaTol` |
control parameter defining convergence |

`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 |

`useT` |
whether to use a t-distribution as a null distribution,
for significance testing of the Wald statistics.
If FALSE, a standard normal null distribution is used.
See next argument |

`df` |
the degrees of freedom for the t-distribution.
This can be of length 1 or the number of rows of |

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

`minmu` |
lower bound on the estimated count while fitting the GLM |

The fitting proceeds as follows: standard maximum likelihood estimates
for GLM coefficients (synonymous with "beta", "log2 fold change", "effect size")
are calculated.
Then, optionally, a zero-centered Normal prior distribution
(`betaPrior`

) is assumed for the coefficients other than the intercept.

Note that this posterior log2 fold change
estimation is now not the default setting for `nbinomWaldTest`

,
as the standard workflow for coefficient shrinkage has moved to
an additional function `link{lfcShrink}`

.

For calculating Wald test p-values, the coefficients are scaled by their
standard errors and then compared to a standard Normal distribution.
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.

Notes on the log2 fold change prior:

The variance of the prior distribution for each non-intercept coefficient is calculated using the observed distribution of the maximum likelihood coefficients. The final coefficients are then maximum a posteriori estimates using this prior (Tikhonov/ridge regularization). See below for details on the prior variance and the Methods section of the DESeq2 manuscript for more detail. The use of a prior has little effect on genes with high counts and helps to moderate the large spread in coefficients for genes with low counts.

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
(function has been copied into DESeq2 to avoid extra dependencies).
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.

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.

a DESeqDataSet with results columns accessible
with the `results`

function. The coefficients and standard errors are
reported on a log2 scale.

1 2 3 4 5 | ```
dds <- makeExampleDESeqDataSet()
dds <- estimateSizeFactors(dds)
dds <- estimateDispersions(dds)
dds <- nbinomWaldTest(dds)
res <- results(dds)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.