R/gendist_roc_format.R
gendist_roc_format.Rd
This is a wrapper function that takes output from the gendist_sensspec_cutoff()
function and constructs values for the
Receiver Operating Characteristic (ROC) curve
gendist_roc_format(
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
data frame with cutoff, sensitivity, and 1-specificity
Other genetic distance functions:
gendist_distribution()
,
gendist_sensspec_cutoff()
Other ROC functions:
optim_roc_threshold()
# ebola-like pathogen
R <- 1.5
mut_rate <- 1
# use simulated generation distributions
data('genDistSim')
mean_gens_pdf <- as.numeric(genDistSim[genDistSim$R == R, -(1:2)])
# get theoretical genetic distance dist based on mutation rate and generation parameters
dists <- as.data.frame(gendist_distribution(mut_rate = mut_rate,
mean_gens_pdf = mean_gens_pdf,
max_link_gens = 1))
dists <- reshape2::melt(dists,
id.vars = 'dist',
variable.name = 'status',
value.name = 'prob')
# get sensitivity and specificity using the same paramters
roc_calc <- gendist_roc_format(cutoff = 1:(max(dists$dist)-1),
mut_rate = mut_rate,
mean_gens_pdf = mean_gens_pdf)