A fixed-sample-size DesignFixed in which whole clusters
of subjects (identified by cluster_col), rather than individual subjects, are
the unit of randomization: every subject in a given cluster always receives the same
treatment assignment. This is the unblocked analog of
DesignFixedBlockedCluster — there is no
stratification step here, so clusters are randomized to treatment as a single pool
rather than within strata. Cluster-level randomization is required whenever
individual-level randomization would create within-cluster interference/spillover
that violates SUTVA (e.g. clusters are classrooms, clinics, villages, or households),
at the cost of an effective sample size driven by the number of clusters, not
subjects, and a corresponding need for cluster-aware inference.
Randomization mechanism. draw_ws_raw(r) extracts each subject's
cluster ID from cluster_col (erroring if any are missing) and calls
cluster_ra (randomizr) once per replicate, which
performs complete random assignment at the cluster level: subject to rounding,
prob_T of clusters are assigned to treatment, and all subjects sharing a
cluster inherit that cluster's assignment. r independent replicate columns are
generated via replicate() (one randomizr call per replicate).
Cluster-aware bootstrap. draw_bootstrap_indices() overrides the
default subject-level bootstrap to resample whole clusters with replacement (via
resample_group_rows_cpp()) rather than individual rows, since outcomes are
correlated within a cluster (shared assignment plus, typically, shared context) and
the exchangeable resampling unit for a valid bootstrap variance/interval estimate is
therefore the cluster, not the subject.
References
Middleton, J. A., and Aronow, P. M. (2015). "Unbiased estimation of the
average treatment effect in cluster-randomized experiments." Statistics,
Politics and Policy, 6(1-2), 39-75, doi:10.1515/spp-2013-0002
. See also
cluster
randomized controlled trial for orientation, and
DesignFixedBlockedCluster for the
blocked variant of this design.
Super classes
Design -> DesignFixed -> DesignFixedCluster
Methods
+ 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_even_allocation()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_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_randomization_draw()Design$supports_resampling()Design$supports_resampling_replay()Design$transform_y()Design$unavailable_inference_classes_due_to_missing_packages()Design$warm_all_subject_data_cache()
DesignFixedCluster$is_a_cluster_capable()
Characterization: this design randomizes whole clusters (see class documentation), so it is cluster-structured by construction.
DesignFixedCluster$new()
Initialize a cluster randomized fixed experimental design (no
blocking/stratification; see
DesignFixedBlockedCluster if
stratification is also needed).
Usage
DesignFixedCluster$new(
cluster_col,
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
cluster_colThe column name in the data that identifies the cluster for each subject.
response_typeThe data type of response values.
prob_TThe target probability that a given cluster is assigned to treatment (subjects inherit their cluster's assignment).
include_is_missing_as_a_new_featureFlag for missingness indicators.
nThe sample size.
verboseFlag for verbosity.
missingness_methodHow to handle missing values in covariates.
design_formulaA formula object.
seedInteger seed for reproducibility.
Examples
des = DesignFixedCluster$new(n = 20, response_type = 'continuous', cluster_col = 'cl')
X = data.frame(x = rnorm(20), cl = factor(rep(1:5, each = 4)))
des$add_all_subjects_to_experiment(X)
des$assign_w_to_all_subjects()
