PatientSample | R Documentation |
Class to house the latent random variables that govern toxicity and efficacy events in patients. Instances of this class can be used in simulation-like tasks to effectively use the same simulated individuals in different designs, thus supporting reduced Monte Carlo error and more efficient comparison.
num_patients
('integer(1)')
tox_u
('numeric(num_patients)')
time_to_tox_func
('function')
tox_time
('numeric(num_patients)')
eff_u
('numeric(num_patients)')
time_to_eff_func
('function')
eff_time
('numeric(num_patients)')
can_grow
('logical(1)')
new()
Creator.
PatientSample$new( num_patients = 0, time_to_tox_func = function() runif(n = 1), time_to_eff_func = function() runif(n = 1) )
num_patients
('integer(1)') Number of patients.
time_to_tox_func
('function') function taking no args that returns a single time of toxicity, given that toxicity occurs.
time_to_eff_func
('function') function taking no args that returns a single time of efficacy, given that efficacy occurs.
[PatientSample].
set_eff_and_tox()
Set the toxicity and efficacy latent variables that govern occurrence of
toxicity and efficacy events. By default, instances of this class
automatically grow these latent variables to accommodate arbitrarily high
sample sizes. However, when you set these latent variables manually via
this function, you override the ability of the class to self-manage, so
its ability to grow is turned off by setting the internal variable
self$can_grow <- FALSE
.
PatientSample$set_eff_and_tox( tox_u, eff_u, tox_time = rep(0, length(tox_u)), eff_time = rep(0, length(eff_u)) )
tox_u
('numeric()') Patient-level toxicity propensities.
eff_u
('numeric()') Patient-level efficacy propensities.
tox_time
('numeric()') Patient-level toxicity times, given that toxicity occurs.
eff_time
('numeric()') Patient-level efficacy times, given that efficacy occurs.
expand_to()
Expand sample to size at least num_patients
PatientSample$expand_to(num_patients)
num_patients
('integer(1)').
get_tox_u()
Get toxicity latent variable for patient i
PatientSample$get_tox_u(i)
i
('integer(1)') patient index
get_patient_tox()
Get 0 or 1 event marker for whether toxicity occurred in patient i
PatientSample$get_patient_tox(i, prob_tox, time = Inf)
i
('integer(1)') patient index
prob_tox
('numeric(1)') probability of toxicity
time
('numeric(1)') at time
get_eff_u()
Get efficacy latent variable for patient i
PatientSample$get_eff_u(i)
i
('integer(1)') patient index
get_patient_eff()
Get 0 or 1 event marker for whether efficacy occurred in patient i
PatientSample$get_patient_eff(i, prob_eff, time = Inf)
i
('integer(1)') patient index
prob_eff
('numeric(1)') probability of efficacy
time
('numeric(1)') at time
clone()
The objects of this class are cloneable with this method.
PatientSample$clone(deep = FALSE)
deep
Whether to make a deep clone.
Sweeting, M., Slade, D., Jackson, D., & Brock, K. (2024). Potential outcome simulation for efficient head-to-head comparison of adaptive dose-finding designs. arXiv preprint arXiv:2402.15460
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.