Title: | Bayesian Estimation and Optimisation of Expected False Discovery Rate |
---|---|
Description: | Implements the Bayesian FDR control described by Newton et al. (2004), <doi:10.1093/biostatistics/5.2.155>. Allows optimisation and visualisation of expected error rates based on tail posterior probability tests. Based on code written by Catalina Vallejos for BASiCS, see Beyond comparisons of means: understanding changes in gene expression at the single-cell level Vallejos et al. (2016) <doi:10.1186/s13059-016-0930-3>. |
Authors: | Alan O'Callaghan [aut, cre], Catalina Vallejos [aut] |
Maintainer: | Alan O'Callaghan <[email protected]> |
License: | GPL-3 |
Version: | 0.2.0 |
Built: | 2024-11-12 04:57:13 UTC |
Source: | https://github.com/vallejosgroup/bayefdr |
A DESCRIPTION OF THE PACKAGE
Detecting differential gene expression with a semiparametric hierarchical mixture method Michael A. Newton, Amine Noueiry, Deepayan Sarkar, Paul Ahlquist https://doi.org/10.1093/biostatistics/5.2.155
Plot the cumulative median, mean, and 95% high posterior density region.
cumplot(x, ylab = NULL, burn = 0, thin = 1, hpd_level = 0.95)
cumplot(x, ylab = NULL, burn = 0, thin = 1, hpd_level = 0.95)
x |
An vector of MCMC draws. |
ylab |
An optional y-axis label. |
burn |
Integer specifying the number of initial iterations to be discarded. |
thin |
Integer specifying the thinning factor to be used on the MCMC steps. |
hpd_level |
Floating point specifying the desired HPD level. |
A ggplot showing the cumulative mean, median and HPD.
x <- rnorm(1000) cumplot(x)
x <- rnorm(1000) cumplot(x)
Calculate the Expected False Discovery Rate (EFDR) or Expected False Negative Rate (EFNR) in a vector of probabilities, given a specified evidence threshold.
efdr(evidence_threshold, probs) efnr(evidence_threshold, probs)
efdr(evidence_threshold, probs) efnr(evidence_threshold, probs)
evidence_threshold |
Scalar value specifying the evidence threshold at which the EFDR or EFNR should be evaluated. |
probs |
Vector of probabilities. |
Given a vector of probabilities, this function finds the probability threshold that matches a target expected false discovery rate as closely as possible.
efdr_search( probs, target_efdr, min_threshold = 0.7, prob_thresholds = seq(0.5, 0.9995, by = 0.00025) )
efdr_search( probs, target_efdr, min_threshold = 0.7, prob_thresholds = seq(0.5, 0.9995, by = 0.00025) )
probs |
Vector of probabilities. |
target_efdr |
Numeric scalar specifying the expected false discovery rate to match. |
min_threshold |
Minimum probability threshold. If the optimal
probability threshold is below this number, it is rejected and
|
prob_thresholds |
Vector for probability thresholds to scan, with the aim of finding the threshold that matches the target EFDR. |
An object of class "bayefdr" containing the probability thresholds tested, the EFDR and EFNR at each probability threshold, and the optimal threshold.
probs <- runif(100) efdr <- efdr_search(probs, target_efdr = 0.1) plot(efdr)
probs <- runif(100) efdr <- efdr_search(probs, target_efdr = 0.1) plot(efdr)
Retrieve the index of the optimal probability threshold.
optimal(x)
optimal(x)
x |
An object of class "bayefdr". |
The integer index of the optimal probability threshold.
probs <- runif(100) e <- efdr_search(probs, target_efdr = 0.1) optimal(e) e[optimal(e), ]
probs <- runif(100) e <- efdr_search(probs, target_efdr = 0.1) optimal(e) e[optimal(e), ]
Plot the EFDR, EFNR grids of a bayefdr object.
## S3 method for class 'bayefdr' plot(x, ...)
## S3 method for class 'bayefdr' plot(x, ...)
x |
An object of class bayefdr. |
... |
Unused. |
A ggplot.
Print methods for bayefdr objects.
## S3 method for class 'bayefdr' print(x, ...) ## S3 method for class 'bayefdr' head(x, ...)
## S3 method for class 'bayefdr' print(x, ...) ## S3 method for class 'bayefdr' head(x, ...)
x |
An object of class bayefdr. |
... |
Unused. |
Trace, marginal density histogram, and autocorrelation plot of MCMC draws.
traceplot(x, ylab = NULL, log = FALSE)
traceplot(x, ylab = NULL, log = FALSE)
x |
A vector of MCMC draws. |
ylab |
An optional y-axis label. |
log |
Logical scalar controlling whether the y-axis should be logged. |
A plot created using plot_grid
showing
the trace, marginal density histogram, and autocorrelation function of the
MCMC draws in x
.
x <- rnorm(1000) traceplot(x)
x <- rnorm(1000) traceplot(x)