Skip to contents

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


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_T

Probability of treatment assignment.

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.

...

Extra arguments passed to the Design superclass.

Returns

A new `DesignFixed` object


DesignFixed$assign_w_to_all_subjects()

Assign treatment to all subjects in the fixed experiment.

Usage

DesignFixed$assign_w_to_all_subjects(w_precomputed = NULL)

Arguments

w_precomputed

Optional {0,1} numeric vector of length n. If supplied the allocation is used directly and draw_ws_according_to_design is not called (avoids e.g. the Java round-trip for DesignFixedGreedy).


DesignFixed$add_all_subjects_to_experiment()

Add all subjects' covariates to a fixed design at once.

Usage

DesignFixed$add_all_subjects_to_experiment(X_all)

Arguments

X_all

A data frame containing the full covariate matrix.

Returns

Invisibly returns the design object.


DesignFixed$add_all_subject_responses()

Add all subject responses for a fixed design.

Usage

DesignFixed$add_all_subject_responses(ys = NULL, y_Ls = NULL, y_Rs = NULL)

Arguments

ys

The exact responses as a numeric vector, NA for any subject whose response is censored (supply y_Ls/y_Rs for those instead).

y_Ls

The censored-response lower bounds, NA for any subject with an exact response in ys. Right-censored: the last known event-free time (pair with y_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 given Inference class can actually consume it depends on that class (most survival Inference classes still only accept exact/ right-censored data and will reject construction with a clear error otherwise – see individual class docs).

y_Rs

The censored-response upper bounds, NA for any subject with an exact response in ys. 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.

Usage

DesignFixed$overwrite_all_subject_assignments(w)

Arguments

w

A {0,1} vector of subject assignments (1 = treated, 0 = control).


DesignFixed$clone()

The objects of this class are cloneable with this method.

Usage

DesignFixed$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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()
} # }