Skip to contents

A 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


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_T

Target probability of treatment assignment; the realized number of treated subjects is fixed at round(n * prob_T) for every draw (unlike DesignFixedBernoulli, where it is random).

include_is_missing_as_a_new_feature

Flag for missingness indicators.

n

The sample size.

verbose

A flag for verbosity.

missingness_method

How to handle missing values in covariates.

design_formula

A formula object.

seed

Integer seed for reproducibility.

Returns

A new `DesignFixediBCRD` object


DesignFixediBCRD$clone()

The objects of this class are cloneable with this method.

Usage

DesignFixediBCRD$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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()