randomizer {imt} | R Documentation |
Randomization Class for Treatment Assignment
Description
This class provides methods to randomly assign treatments to a dataset while ensuring baseline covariate balance. It can handle both simple and stratified randomization.
Active bindings
version
The version of the
im
package used for randomization.data
The data frame with the assigned treatment.
seed
The random seed used for reproducibility.
balance_summary
A summary (or list of summaries) of the balance assessment after randomization.
balance_plot
A plot (or list of plots) of the balance assessment after randomization.
Methods
Public methods
Method new()
Initialize a new Randomizer object.
Usage
randomizer$new( data, variables, standard = "Not Concerned", seed = NULL, max_attempts = 100, group_by = NULL )
Arguments
data
The input data frame.
variables
A vector of covariate names to check for balance.
standard
The 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.
Returns
A new randomizer
object.
Method clone()
The objects of this class are cloneable with this method.
Usage
randomizer$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.