Skip to contents

A DesignSeqOneByOne implementing the "random allocation rule" (a sequential realization of complete randomization): treatment is assigned to each arriving subject with probability equal to the fraction of remaining treatment slots among all remaining slots, \(\Pr(w_t = 1) = n_{T,\mathrm{rem}} / (n_{T,\mathrm{rem}} + n_{C,\mathrm{rem}})\), where \(n_{T,\mathrm{rem}} = \mathrm{round}(n \cdot prob\_T) - n_T\) and \(n_{C,\mathrm{rem}} = (n - \mathrm{round}(n \cdot prob\_T)) - n_C\) are the treatment/control slots not yet used, given the running counts \(n_T\), \(n_C\). This guarantees the realized sequence, once all \(n\) subjects have arrived, has exactly \(\mathrm{round}(n \cdot prob\_T)\) treated subjects — the same terminal allocation-count guarantee as DesignFixediBCRD's complete randomization, but realized online as subjects arrive one at a time rather than all at once, and with every prefix of the sequence itself drawn from the correct conditional (hypergeometric) distribution given the slots used so far. If a slot type is exhausted (\(n_{T,\mathrm{rem}} \le 0\) or \(n_{C,\mathrm{rem}} \le 0\)), the remaining subjects are deterministically assigned to whichever type still has open slots.

No target \(n\): falls back to Bernoulli. If n was not supplied at construction (private$n is NULL), there is no terminal target to balance toward, so assign_wt() falls back to an unbiased \(\mathrm{Bernoulli}(prob\_T)\) draw for every subject instead (equivalent to DesignSeqOneByOneBernoulli).

Single implicit block. add_one_subject_to_experiment_and_assign() overrides the inherited method only to additionally set private$m to a constant vector of 1s (a single block containing every subject enrolled so far) after each assignment, mirroring the fixed-sample DesignFixediBCRD's single-block convention for shared blocking/matching machinery.

References

Rosenberger, W. F., and Lachin, J. M. (2016). Randomization in Clinical Trials: Theory and Practice (2nd ed.), Wiley, for the random allocation rule as a sequential implementation of complete randomization. See also DesignFixediBCRD for the fixed-sample (all-at-once) version of the same terminal randomization law.

Super classes

Design -> DesignSeqOneByOne -> DesignSeqOneByOneiBCRD

Methods

+ inherited public methods from DesignSeqOneByOne
+ inherited public methods from Design


DesignSeqOneByOneiBCRD$new()

Initialize a sequential design targeting exact terminal treatment/control balance (see class documentation for the assignment rule and the no-fixed-n fallback).

Usage

DesignSeqOneByOneiBCRD$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 terminal number of treated subjects is fixed at round(n * prob_T) when n is known (see class documentation).

include_is_missing_as_a_new_feature

Flag for missingness indicators.

n

The planned (target) sample size; if NULL, there is no terminal balance target and assignment falls back to an unbiased Bernoulli coin (see class documentation).

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 `DesignSeqOneByOneiBCRD` object


DesignSeqOneByOneiBCRD$add_one_subject_to_experiment_and_assign()

Add one subject to the experiment and assign treatment via assign_wt() (delegating to the inherited DesignSeqOneByOne$add_one_subject_to_experiment_and_assign()), then set private$m to a single-block vector of 1s covering every subject enrolled so far (see class documentation), overwritten on every call rather than only once all subjects have arrived.

Usage

DesignSeqOneByOneiBCRD$add_one_subject_to_experiment_and_assign(x_new)

Arguments

x_new

A data frame with one row representing the new subject's covariates.

Returns

The treatment assignment (0 or 1) for the newly added subject.


DesignSeqOneByOneiBCRD$assign_wt()

Draw the next subject's treatment assignment via the random allocation rule (see class documentation): with probability equal to the fraction of remaining treatment slots among all remaining slots, or a deterministic assignment if one slot type is exhausted; falls back to an unbiased Bernoulli coin if no fixed n was supplied.

Usage

DesignSeqOneByOneiBCRD$assign_wt()

Returns

The treatment assignment (0 or 1) for the next subject.


DesignSeqOneByOneiBCRD$clone()

The objects of this class are cloneable with this method.

Usage

DesignSeqOneByOneiBCRD$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

seq_des = DesignSeqOneByOneiBCRD$new(n = 6, response_type = 'continuous')
seq_des$add_one_subject_to_experiment_and_assign(data.frame(x1 = rnorm(1)))
#> [1] 1