get_potential_outcomes {escalation} | R Documentation |
Get potential outcomes from a list of PatientSamples
Description
An instance of PatientSample
, or one of its subclasses like
CorrelatedPatientSample
, reflects one particular state of the
world, where patient i would reliably experience a toxicity or efficacy
event if treated at a particular dose. This function, given true toxicity and
efficacy probabilities at doses 1, ..., num_doses, calculates 0/1 matrices to
reflect whether the patients in those samples would have experienced toxicity
and efficacy at the doses, had they been dosed as such. Using the
vernacular of causal inference, these are _potential outcomes_. At any single
instant, a patient can only be dosed at one dose, so only one of the
outcomes for a patient would in reality have been observed; the rest are
counterfactual.
Usage
get_potential_outcomes(patient_samples, true_prob_tox, true_prob_eff)
Arguments
patient_samples |
list of |
true_prob_tox |
vector of probabilities of toxicity outcomes at doses |
true_prob_eff |
vector of probabilities of efficacy outcomes at doses |
Value
a list of lists, with names tox and eff, each mapping to a matrix of the potential outcomes.
Examples
num_sims <- 10
ps <- lapply(1:num_sims, function(x) PatientSample$new())
# Set tox_u and eff_u for each simulation
set.seed(2024)
lapply(1:num_sims, function(x) {
tox_u_new <- runif(n = 20)
eff_u_new <- runif(n = 20)
ps[[x]]$set_eff_and_tox(tox_u = tox_u_new, eff_u = eff_u_new)
})
true_prob_tox <- c(0.05, 0.10, 0.15, 0.18, 0.45)
true_prob_eff <- c(0.40, 0.50, 0.52, 0.53, 0.53)
get_potential_outcomes(
patient_samples = ps,
true_prob_tox = true_prob_tox,
true_prob_eff = true_prob_eff
)