R/gendist_sensspec_cutoff.R
gendist_sensspec_cutoff.Rd
Function to calculate the sensitivity and specificity of a genetic distance cutoff given an underlying mutation rate and mean number of generations between cases
gendist_sensspec_cutoff(
cutoff,
mut_rate,
mean_gens_pdf,
max_link_gens = 1,
max_gens = NULL,
max_dist = NULL
)
the maximum genetic distance at which to consider cases linked
mean number of mutations per generation, assumed to be Poisson distributed
the density distribution of the mean number of generations between cases; the index of this vector is assumed to be the discrete distance between cases
the maximum generations of separation for linked pairs
the maximum number of generations to consider, if NULL
(default) value set to the highest
number of generations in mean_gens_pdf with a non-zero probability
the maximum distance to calculate, if NULL
(default) value set to max_gens * 99.9th percentile
of mut_rate Poisson distribution
a data frame with the sensitivity and specificity for a particular genetic distance cutoff
Other genetic distance functions:
gendist_distribution()
,
gendist_roc_format()
# calculate the sensitivity and specificity for a specific genetic distance threshold of 2 mutations
gendist_sensspec_cutoff(cutoff=2,
mut_rate=1,
mean_gens_pdf=c(0.02,0.08,0.15,0.75),
max_link_gens=1)
#> cutoff sensitivity specificity
#> [1,] 2 0.7357589 0.8662894
# calculate the sensitivity and specificity for a a range of genetic distance thresholds
gendist_sensspec_cutoff(cutoff=1:10,
mut_rate=1,
mean_gens_pdf=c(0.02,0.08,0.15,0.75),
max_link_gens=1)
#> cutoff sensitivity specificity
#> [1,] 1 0.3678794 0.967314682
#> [2,] 2 0.7357589 0.866289434
#> [3,] 3 0.9196986 0.697765199
#> [4,] 4 0.9810118 0.499227295
#> [5,] 5 0.9963402 0.316627604
#> [6,] 6 0.9994058 0.178637743
#> [7,] 7 0.9999168 0.090198436
#> [8,] 8 0.9999898 0.041044514
#> [9,] 9 0.9999989 0.016951040
#> [10,] 10 0.9999999 0.006396198