Base R function to either do exact enumeration or Monte Carlo random permutations, then keep the fraction whose T^2 is below the acceptance cutoff.
generate_randomizations_R(
n_units,
n_treated,
X,
accept_prob,
random_type,
max_draws,
batch_size
)A list with:
randomizations: a matrix (rows = accepted assignments).
balance: numeric vector of T^2 values for each accepted assignment.
Integer, total number of units.
Integer, number of units to be assigned to treatment.
Covariate matrix (n_units x p).
Numeric in [0, 1]: keep the fraction of randomizations that have the lowest T^2 up to this quantile.
Either "exact" or "monte_carlo".
If `random_type="monte_carlo"`, how many permutations to sample.
If `random_type="monte_carlo"`, how many permutations to handle per chunk.