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

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 min_threshold is used instead.

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)