forked from VallejosGroup/bayefdr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
62 lines (49 loc) · 1.7 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
output: md_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
set.seed(42)
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# bayefdr
<!-- badges: start -->
[![R build status](https://github.com/VallejosGroup/bayefdr/workflows/R-CMD-check/badge.svg)](https://github.com/VallejosGroup/bayefdr/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/bayefdr)](https://CRAN.R-project.org/package=bayefdr)
[![downloads](http://cranlogs.r-pkg.org/badges/grand-total/bayefdr)](https://CRAN.R-project.org/package=bayefdr)
<!-- badges: end -->
The goal of bayefdr is to provide tools for the estimation and optimisation
of Bayesian expected false discovery and expected false negative rates.
## Installation
You can install the released version of bayefdr from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("bayefdr")
# development version:
## devtools::install_github("VallejosGroup/bayefdr")
```
## Usage
The main functions in this package are `efdr`, `efnr` and `efdr_search`.
`efdr` and `efnr` calculate the EFDR or EFNR for a vector of probabilities
given a specified probability threshold. `efdr_search` finds the probability
threshold that matches a target EFDR as closely as possible.
The basic input to this function is a vector of probabilities and a target EFDR.
```{r example}
library("bayefdr")
set.seed(42)
probs <- runif(100)
efdr(0.7, probs)
efnr(0.7, probs)
efdr <- efdr_search(probs, target_efdr = 0.1)
efdr
```
The output of this function is a `data.frame` with some extra attributes. There
is a plot method too.
```{r outputs}
head(efdr)
plot(efdr)
```