
A Fixed Observational (Non-Randomized) Design With Blocks
Source:R/design_observational_blocks.R
ObservationalDesignBlocks.RdAn 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
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_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_resampling()Design$transform_y()Design$unavailable_inference_classes_due_to_missing_packages()Design$warm_all_subject_data_cache()
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".
mA 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).nis derived aslength(m)and is not a separate argument.include_is_missing_as_a_new_featureFlag for missingness indicators.
verboseA flag for verbosity.
missingness_methodHow to handle missing values in covariates.
design_formulaA formula object.
seedInteger seed for reproducibility.
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))