An abstract R6 Class encapsulating the data and functionality for a fixed experimental design. This class takes care of whole-experiment randomization.
Super class
Design -> DesignFixed
Methods
+ 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_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_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()
DesignFixed$new()
Initialize a fixed experimental design
Usage
DesignFixed$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_TProbability of treatment assignment.
include_is_missing_as_a_new_featureFlag for missingness indicators.
nThe sample size.
verboseA flag for verbosity.
missingness_methodHow to handle missing values in covariates.
design_formulaA formula object.
seedInteger seed for reproducibility.
...Extra arguments passed to the
Designsuperclass.
DesignFixed$add_all_subjects_to_experiment()
Add all subjects' covariates to a fixed design at once.
DesignFixed$add_all_subject_responses()
Add all subject responses for a fixed design.
Arguments
ysThe exact responses as a numeric vector,
NAfor any subject whose response is censored (supplyy_Ls/y_Rsfor those instead).y_LsThe censored-response lower bounds,
NAfor any subject with an exact response inys. Right-censored: the last known event-free time (pair withy_Rs = Inf). Left-censored:0, stated explicitly. Interval-censored: the interval's lower bound. Storage accepts any well-formed left-/interval-censored value; whether a givenInferenceclass can actually consume it depends on that class (most survivalInferenceclasses still only accept exact/ right-censored data and will reject construction with a clear error otherwise – see individual class docs).y_RsThe censored-response upper bounds,
NAfor any subject with an exact response inys. Right-censored:Inf. Left-/interval-censored: the confirmed-by time / interval upper bound.
DesignFixed$overwrite_all_subject_assignments()
Overwrite all subject assignments for a fixed design.
Examples
if (FALSE) { # \dontrun{
# DesignFixed is abstract and cannot be instantiated directly; construct a
# concrete subclass instead, e.g.:
des = DesignFixedBernoulli$new(n = 10, response_type = 'continuous')
des$add_all_subjects_to_experiment(data.frame(x1 = rnorm(10)))
des$assign_w_to_all_subjects()
} # }
