View source: R/decision_threshold.R
| decision_threshold | R Documentation |
Calculates the optimal likelihood ratio (LR) threshold for classifying matches versus non-matches, based on the trade-off between false positive and false negative rates.
The optimal threshold minimizes a weighted Euclidean distance that balances the costs of different types of errors.
decision_threshold(datasim, weight = 10)
datasim |
A data.frame with columns |
weight |
Numeric. The relative weight of false positives compared to false negatives. A value > 1 penalizes false positives more heavily. Default: 10 (false positives are 10x worse than false negatives). |
If the input is a list (output from sim_lr_genetic), it is
automatically converted to a data.frame using lr_to_dataframe.
Algorithm: The function computes the weighted Euclidean distance for each potential threshold value:
D = \sqrt{FNR^2 + (weight \times FPR)^2}
The threshold that minimizes this distance is returned as optimal.
Weight interpretation:
weight = 1: Equal importance to FPR and FNR
weight = 10: FPR is 10x more costly than FNR
weight > 10: Very conservative (minimizes false positives)
weight < 1: Aggressive (minimizes false negatives)
In missing person cases, false positives (wrongly identifying someone as the missing person) are typically considered more serious than false negatives (failing to identify a true match), justifying weight > 1.
Prints and invisibly returns the suggested LR threshold value.
Marsico FL, Vigeland MD, Egeland T, Herrera Pinero F (2021). "Making decisions in missing person identification cases with low statistical power." Forensic Science International: Genetics, 52, 102519. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.fsigen.2021.102519")}
threshold_rates for computing error rates at a given threshold,
plot_decision_curve for visualizing the FPR/FNR trade-off,
plot_lr_distribution for LR distribution visualization.
# Simulate LRs
lr_sims <- sim_lr_prelim("sex", numsims = 500, seed = 123)
# Find optimal threshold (FP 10x worse than FN)
threshold <- decision_threshold(lr_sims, weight = 10)
# Check error rates at this threshold
threshold_rates(lr_sims, threshold)
# More conservative threshold (FP 20x worse)
decision_threshold(lr_sims, weight = 20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.