Crystallise a set of dose_paths
with probabilities to calculate
how likely each path is. Once probabilised in this way, the probabilities of
the terminal nodes in this set of paths will sum to 1. This allows users to
calculate operating characteristics.
calculate_probabilities(dose_paths, true_prob_tox, true_prob_eff = NULL, ...)
Object of type dose_paths
Numeric vector, true probability of toxicity.
vector of true efficacy probabilities, optionally NULL if efficacy not analysed.
Extra parameters
# Phase 1 example.
# Calculate dose paths for the first three cohorts in a 3+3 trial of 5 doses:
paths <- get_three_plus_three(num_doses = 5) %>%
get_dose_paths(cohort_sizes = c(3, 3, 3))
# Set the true probabilities of toxicity
true_prob_tox <- c(0.12, 0.27, 0.44, 0.53, 0.57)
# And calculate exact operating performance
x <- paths %>% calculate_probabilities(true_prob_tox)
prob_recommend(x)
#> NoDose 1 2 3 4 5
#> 0.12854451 0.33600635 0.19081343 0.29807918 0.04655654 0.00000000
# Phase 1/2 example.
prob_select = c(0.1, 0.3, 0.5, 0.07, 0.03)
selector_factory <- get_random_selector(prob_select = prob_select,
supports_efficacy = TRUE)
paths <- selector_factory %>% get_dose_paths(cohort_sizes = c(2, 2))
#> You have requested 100 paths. Be patient.
true_prob_eff <- c(0.27, 0.35, 0.41, 0.44, 0.45)
x <- paths %>% calculate_probabilities(true_prob_tox = true_prob_tox,
true_prob_eff = true_prob_eff)
prob_recommend(x)
#> NoDose 1 2 3 4 5
#> 0.00000000 0.10881060 0.28244334 0.41956189 0.14690224 0.04228193