This class provides methods to randomly assign treatments to a dataset while ensuring baseline covariate balance. It can handle both simple and stratified randomization.
versionThe version of the im package used for randomization.
dataThe data frame with the assigned treatment.
seedThe random seed used for reproducibility.
balance_summaryA summary (or list of summaries) of the balance assessment after randomization.
balance_plotA plot (or list of plots) of the balance assessment after randomization.
new()Initialize a new Randomizer object.
randomizer$new(
data,
variables,
standard = "Not Concerned",
seed = NULL,
max_attempts = 100,
group_by = NULL
)dataThe input data frame.
variablesA vector of covariate names to check for balance.
standardThe desired level of baseline equivalence. Must be one of "Not Concerned", "Concerned", or "Very Concerned". Default is "Not Concerned". ("Not Concerned", "Concerned", or "Very Concerned").
seed(Optional) An integer to set the random seed.
max_attempts(Optional) Maximum number of randomization attempts.
group_by(Optional) A character vector of column names to stratify randomization.
A new randomizer object.
clone()The objects of this class are cloneable with this method.
randomizer$clone(deep = FALSE)deepWhether to make a deep clone.