
A Fixed, Individually Balanced Completely Randomized Design (iBCRD)
Source:R/design_fixed_ibcrd.R
DesignFixediBCRD.RdA fixed-sample-size DesignFixed implementing the
individually balanced complete randomized design (iBCRD): the number of treated
subjects is fixed at exactly \(n_T = \mathrm{round}(n \cdot prob\_T)\), and each
allocation \(w\) with exactly \(n_T\) ones is drawn uniformly at random from the
\(\binom{n}{n_T}\) possible such allocations (via a Fisher-Yates shuffle of a base
vector with \(n_T\) ones and \(n - n_T\) zeros). This is the classical "complete
randomization" reference design of randomization inference: unlike
DesignFixedBernoulli (independent per-subject
coin flips, random \(n_T\)), \(n_T\) is fixed here, which is what makes exact
permutation/randomization tests over the \(\binom{n}{n_T}\) allocations well-defined;
unlike DesignFixedGreedyDOptimal/
DesignFixedGreedy, no covariate information is
used to select among those allocations — every one of the \(\binom{n}{n_T}\)
allocations is equally likely.
Draw mechanism. draw_ws_raw(r) delegates to
generate_permutations_ibcrd_cpp(), which builds one base allocation vector
(\(n_T\) ones followed by \(n - n_T\) zeros) and independently
shuffles (Fisher-Yates via std::shuffle) a fresh copy of it
per replicate column, seeded from R's own RNG stream (so seed does govern
reproducibility here, unlike the A-/D-optimal exchange searches).
assign_w_to_all_subjects() draws one such allocation (r = 1) and applies
it to all subjects.
Single implicit block. The constructor sets private$m to a constant
vector of 1s (a single block containing every subject) once n is known, so that
shared blocking/matching machinery that expects a block-membership vector treats the
whole sample as one block by default.
References
Fisher, R. A. (1935). The Design of Experiments. Oliver and Boyd, for complete randomization as the canonical reference design of randomization inference. See also randomized experiment for orientation on complete vs. Bernoulli randomization.
Super classes
Design -> DesignFixed -> DesignFixediBCRD
Methods
+ inherited public methods from DesignFixed
+ inherited public methods from Design
Design$add_one_subject_response()Design$any_censoring()Design$applicable_inference_class_names()Design$assert_all_responses_recorded()Design$assert_all_subjects_arrived()Design$assert_even_allocation()Design$assert_fixed_sample()Design$capabilities()Design$check_experiment_completed()Design$draw_ws_according_to_design()Design$duplicate()Design$get_X()Design$get_X_imp()Design$get_X_raw()Design$get_design_formula()Design$get_edi_version_created()Design$get_effective_dead()Design$get_effective_time()Design$get_missingness_method()Design$get_n()Design$get_ordinal_levels()Design$get_original_ordinal_levels()Design$get_prob_T()Design$get_response_type()Design$get_response_type_original()Design$get_t()Design$get_w()Design$get_y()Design$get_y_L()Design$get_y_R()Design$get_y_original()Design$has_general_censoring()Design$incompatible_inference_classes_due_to_design_structure()Design$is_a_bernoulli_capable()Design$is_a_cluster_capable()Design$is_a_kk_matching_capable()Design$is_blocking_design()Design$is_fixed_sample_size()Design$is_matching_design()Design$prepare_for_resampling_replay()Design$randomization_family()Design$supports()Design$supports_randomization_draw()Design$supports_resampling()Design$supports_resampling_replay()Design$transform_y()Design$unavailable_inference_classes_due_to_missing_packages()Design$warm_all_subject_data_cache()
DesignFixediBCRD$new()
Initialize a fixed individually balanced completely randomized experimental design (see class documentation for the exact randomization law).
Usage
DesignFixediBCRD$new(
response_type,
prob_T = 0.5,
include_is_missing_as_a_new_feature = TRUE,
n = NULL,
verbose = FALSE,
missingness_method = "impute",
design_formula = ~.,
seed = NULL
)Arguments
response_type"continuous", "incidence", "proportion", "count", "survival", or "ordinal".
prob_TTarget probability of treatment assignment; the realized number of treated subjects is fixed at
round(n * prob_T)for every draw (unlikeDesignFixedBernoulli, where it is random).include_is_missing_as_a_new_featureFlag for missingness indicators.
nThe sample size.
verboseA flag for verbosity.
missingness_methodHow to handle missing values in covariates.
design_formulaA formula object.
seedInteger seed for reproducibility.
Examples
des = DesignFixediBCRD$new(n = 10, response_type = 'continuous')
des$add_all_subjects_to_experiment(data.frame(x1 = rnorm(10)))
des$assign_w_to_all_subjects()