Skip to contents

A fixed-sample-size DesignFixed whose treatment assignment vector \(w\) is supplied by the user (e.g. via assign_w_to_all_subjects(w_precomputed = ...) or overwrite_all_subject_assignments()) rather than drawn from any randomization mechanism. Unlike every other DesignFixed subclass, there is no prob_T to specify – treatment was not assigned by the experimenter according to a known probability law, so no such probability exists to declare.

No draw mechanism. draw_ws_according_to_design() (and, transitively, the fallback branch of assign_w_to_all_subjects() that would otherwise call it) always throws. Any inference procedure that must redraw \(w\) from the design's own randomization law – randomization tests, randomization confidence intervals, and randomization/assignment bootstrap – therefore throws the same clear error rather than silently fabricating a randomization mechanism that never existed. Procedures that resample subjects instead of redrawing \(w\) (plain nonparametric bootstrap, Bayesian bootstrap) are unaffected and remain available, since resampling subjects with their observed, fixed assignment does not require a known randomization probability.

No balance target. assert_even_allocation() is a no-op here (rather than the inherited check against prob_T = 0.5): there is no targeted allocation ratio for an observational design to be out of balance with.

Super classes

Design -> DesignFixed -> ObservationalDesign

Methods

+ inherited public methods from DesignFixed
+ inherited public methods from Design


ObservationalDesign$new()

Initialize a fixed observational (non-randomized) design. No treatment vector is drawn or requested here; the constructor only records configuration (covariates, response type, etc.) and internally fixes prob_T = 0.5 purely so the shared Design/DesignFixed machinery has a value to store — it is never used to draw or validate an allocation for this class (see assert_even_allocation() and class documentation). \(w\) itself is supplied afterward via assign_w_to_all_subjects(w_precomputed = ...) or overwrite_all_subject_assignments().

Usage

ObservationalDesign$new(
  response_type,
  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".

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. Note this design has no randomization mechanism to seed (see class documentation); seed only affects RNG-dependent behavior inherited from Design unrelated to treatment assignment (e.g. imputation, bootstrap resampling).

Returns

A new `ObservationalDesign` object


ObservationalDesign$assert_even_allocation()

Observational designs have no targeted allocation ratio to check balance against, so this is a no-op rather than an error (contrast with the inherited Design$assert_even_allocation(), which errors if the realized allocation deviates from prob_T = 0.5).

Usage

ObservationalDesign$assert_even_allocation()

Returns

invisible(NULL), always; never errors.


ObservationalDesign$supports_randomization_draw()

Characterization: FALSE – this design has no randomization mechanism to redraw \(w\) from (see class documentation). Metadata-declared replacement for the old draw_ws_raw() throwing stub (still present below as a fallback for any caller that reaches it without checking this first – see fix_design_hierarchy.md, "Observational Design Migration").

Usage

ObservationalDesign$supports_randomization_draw()

Returns

Always FALSE for this class.


ObservationalDesign$supports_resampling_replay()

Characterization: FALSE – this design has no randomization mechanism to replay against resampled data (bootstrap randomization test eligibility). Plain nonparametric/Bayesian/m-out-of-n/ PRW-subsampling bootstrap are unaffected (see Design$supports_resampling()'s documentation) and remain available.

Usage

ObservationalDesign$supports_resampling_replay()

Returns

Always FALSE for this class.


ObservationalDesign$clone()

The objects of this class are cloneable with this method.

Usage

ObservationalDesign$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

des = ObservationalDesign$new(n = 10, response_type = 'continuous')
des$add_all_subjects_to_experiment(data.frame(x1 = rnorm(10)))
des$assign_w_to_all_subjects(w_precomputed = rbinom(10, 1, 0.3))