Skip to contents

Abstract R6 class encapsulating data and functionality for a sequential one-by- one experimental design.

Super class

Design -> DesignSeqOneByOne

Methods

+ inherited public methods from Design


DesignSeqOneByOne$new()

Initialize a sequential one-by-one design.

Usage

DesignSeqOneByOne$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

The data type of response values.

prob_T

The probability of the treatment assignment.

include_is_missing_as_a_new_feature

If missing data is present, include a dummy variable for it.

n

The sample size (if fixed).

verbose

Whether to print progress messages.

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.


DesignSeqOneByOne$add_one_subject()

Add subject-specific measurements for the next subject entrant.

Usage

DesignSeqOneByOne$add_one_subject(x_new, allow_new_cols = TRUE)

Arguments

x_new

A data frame with one row representing the new subject's covariates.

allow_new_cols

Allow new features in the new subject's covariates.


DesignSeqOneByOne$add_one_subject_to_experiment_and_assign()

Adds a subject and assigns treatment.

Usage

DesignSeqOneByOne$add_one_subject_to_experiment_and_assign(x_new)

Arguments

x_new

A data frame with one row representing the new subject's covariates.

Returns

The treatment assignment as {0,1} (1 = treated, 0 = control).


DesignSeqOneByOne$assign_wt()

Assigns treatment to the current subject.

Usage

DesignSeqOneByOne$assign_wt()

Returns

The treatment assignment (0 or 1).


DesignSeqOneByOne$print_current_subject_assignment()

Prints the current subject's assignment.

Usage

DesignSeqOneByOne$print_current_subject_assignment()


DesignSeqOneByOne$clone()

The objects of this class are cloneable with this method.

Usage

DesignSeqOneByOne$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (FALSE) { # \dontrun{
# DesignSeqOneByOne is abstract and cannot be instantiated directly;
# construct a concrete subclass instead, e.g.:
seq_des = DesignSeqOneByOneBernoulli$new(n = 6, response_type = 'continuous')
seq_des$add_one_subject_to_experiment_and_assign(data.frame(x1 = rnorm(1)))
} # }