PatientSample {escalation} | R Documentation |
A sample of patients to use in simulations.
Description
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.
Public fields
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)')
Methods
Public methods
Method new()
Creator.
Usage
PatientSample$new( num_patients = 0, time_to_tox_func = function() runif(n = 1), time_to_eff_func = function() runif(n = 1) )
Arguments
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.
Returns
[PatientSample].
Method 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
.
Usage
PatientSample$set_eff_and_tox( tox_u, eff_u, tox_time = rep(0, length(tox_u)), eff_time = rep(0, length(eff_u)) )
Arguments
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.
Method expand_to()
Expand sample to size at least num_patients
Usage
PatientSample$expand_to(num_patients)
Arguments
num_patients
('integer(1)').
Method get_tox_u()
Get toxicity latent variable for patient i
Usage
PatientSample$get_tox_u(i)
Arguments
i
('integer(1)') patient index
Method get_patient_tox()
Get 0 or 1 event marker for whether toxicity occurred in patient i
Usage
PatientSample$get_patient_tox(i, prob_tox, time = Inf)
Arguments
i
('integer(1)') patient index
prob_tox
('numeric(1)') probability of toxicity
time
('numeric(1)') at time
Method get_eff_u()
Get efficacy latent variable for patient i
Usage
PatientSample$get_eff_u(i)
Arguments
i
('integer(1)') patient index
Method get_patient_eff()
Get 0 or 1 event marker for whether efficacy occurred in patient i
Usage
PatientSample$get_patient_eff(i, prob_eff, time = Inf)
Arguments
i
('integer(1)') patient index
prob_eff
('numeric(1)') probability of efficacy
time
('numeric(1)') at time
Method clone()
The objects of this class are cloneable with this method.
Usage
PatientSample$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
References
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