Skip to contents

An ObservationalDesign whose subjects are additionally partitioned into user-supplied blocks (matched sets / strata), via the block-membership vector \(m\). As with ObservationalDesign, there is no randomization mechanism at all – neither the treatment assignment \(w\) nor the block membership \(m\) is drawn by this class, both are supplied by the user – so draw_ws_according_to_design() still always throws (inherited unchanged from ObservationalDesign).

Why blocks, if there's no randomization to block on? Blocking here is not a randomization restriction (there is none); it is a resampling structure. Supplying \(m\) lets bootstrap procedures resample within blocks – exactly as they do for DesignFixedBlocking and DesignFixedOptimalBlocks – which is appropriate when the observational data itself has a matched/stratified/clustered structure (e.g. matched case-control sets, repeated measurements within site) that the bootstrap should respect.

No auto-derived n. Unlike plain ObservationalDesign, n is not a constructor argument here at all – it is always length(m), since a block membership vector with one entry per subject already fixes the sample size.

Super classes

Design -> DesignFixed -> ObservationalDesign -> ObservationalDesignBlocks

Methods

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


ObservationalDesignBlocks$new()

Initialize a fixed observational (non-randomized) design with user-supplied block membership. Neither treatment w nor block membership m is drawn here — both must be supplied (m at construction, w afterward via assign_w_to_all_subjects(w_precomputed = ...)); see class documentation for why blocks are still useful without a randomization mechanism to block on.

Usage

ObservationalDesignBlocks$new(
  response_type,
  m,
  include_is_missing_as_a_new_feature = TRUE,
  verbose = FALSE,
  missingness_method = "impute",
  design_formula = ~.,
  seed = NULL
)

Arguments

response_type

"continuous", "incidence", "proportion", "count", "survival", or "ordinal".

m

A positive-integer vector of block (matched-set/stratum) identifiers, one entry per subject; a block may contain any number of subjects (unlike ObservationalDesignMatching, which fixes block size at exactly 2). n is derived as length(m) and is not a separate argument.

include_is_missing_as_a_new_feature

Flag for missingness indicators.

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


ObservationalDesignBlocks$clone()

The objects of this class are cloneable with this method.

Usage

ObservationalDesignBlocks$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

des = ObservationalDesignBlocks$new(response_type = 'continuous', m = c(1, 1, 2, 2, 3, 3))
des$add_all_subjects_to_experiment(data.frame(x1 = rnorm(6)))
des$assign_w_to_all_subjects(w_precomputed = c(1, 0, 1, 0, 1, 0))