| Type: | Package | 
| Title: | Bayesian Estimation and Optimisation of Expected False Discovery Rate | 
| Version: | 0.2.1 | 
| Date: | 2022-10-26 | 
| 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>. | 
| Imports: | ggplot2, reshape2, assertthat, utils, cowplot, ggExtra, stats | 
| License: | GPL-3 | 
| BugReports: | https://github.com/VallejosGroup/bayefdr/issues | 
| RoxygenNote: | 7.2.1 | 
| Encoding: | UTF-8 | 
| URL: | https://github.com/VallejosGroup/bayefdr | 
| Suggests: | testthat, pkgdown | 
| Language: | en-gb | 
| NeedsCompilation: | no | 
| Packaged: | 2022-10-26 19:20:25 UTC; alan | 
| Author: | Alan O'Callaghan [aut, cre], Catalina Vallejos [aut] | 
| Maintainer: | Alan O'Callaghan <alan.ocallaghan@outlook.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2022-10-26 19:35:06 UTC | 
The 'nibbles' package.
Description
A DESCRIPTION OF THE PACKAGE
References
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.
Description
Plot the cumulative median, mean, and 95% high posterior density region.
Usage
cumplot(x, ylab = NULL, burn = 0, thin = 1, hpd_level = 0.95)
Arguments
| 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. | 
Value
A ggplot showing the cumulative mean, median and HPD.
Examples
x <- rnorm(1000)
cumplot(x)
EFDR and EFNR estimation
Description
Calculate the Expected False Discovery Rate (EFDR) or Expected False Negative Rate (EFNR) in a vector of probabilities, given a specified evidence threshold.
Usage
efdr(evidence_threshold, probs)
efnr(evidence_threshold, probs)
Arguments
| evidence_threshold | Scalar value specifying the evidence threshold at which the EFDR or EFNR should be evaluated. | 
| probs | Vector of probabilities. | 
Bayesian EFDR optimisation.
Description
Given a vector of probabilities, this function finds the probability threshold that matches a target expected false discovery rate as closely as possible.
Usage
efdr_search(
  probs,
  target_efdr,
  min_threshold = 0.7,
  prob_thresholds = seq(0.5, 0.9995, by = 0.00025)
)
Arguments
| 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. | 
Value
An object of class "bayefdr" containing the probability thresholds tested, the EFDR and EFNR at each probability threshold, and the optimal threshold.
Examples
 probs <- runif(100)
 efdr <- efdr_search(probs, target_efdr = 0.1)
 plot(efdr)
Retrieve the index of the optimal probability threshold.
Description
Retrieve the index of the optimal probability threshold.
Usage
optimal(x)
Arguments
| x | An object of class "bayefdr". | 
Value
The integer index of the optimal probability threshold.
Examples
 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.
Description
Plot the EFDR, EFNR grids of a bayefdr object.
Usage
## S3 method for class 'bayefdr'
plot(x, ...)
Arguments
| x | An object of class bayefdr. | 
| ... | Unused. | 
Value
A ggplot.
Print methods for bayefdr objects.
Description
Print methods for bayefdr objects.
Usage
## S3 method for class 'bayefdr'
print(x, ...)
## S3 method for class 'bayefdr'
head(x, ...)
Arguments
| x | An object of class bayefdr. | 
| ... | Unused. | 
Trace, marginal density histogram, and autocorrelation plot of MCMC draws.
Description
Trace, marginal density histogram, and autocorrelation plot of MCMC draws.
Usage
traceplot(x, ylab = NULL, log = FALSE)
Arguments
| x | A vector of MCMC draws. | 
| ylab | An optional y-axis label. | 
| log | Logical scalar controlling whether the y-axis should be logged. | 
Value
A plot created using plot_grid showing
the trace, marginal density histogram, and autocorrelation function of the
MCMC draws in x.
Examples
x <- rnorm(1000)
traceplot(x)