Learn R Programming

whatifbandit (version 0.3.0)

impute_success: Imputing New Outcomes of Multi-Arm-Bandit Trial

Description

Imputes outcomes for the current treatment assignment period. Uses randomizr::block_ra() to impute the outcomes for observations who were assigned new treatments. The probabilities used to guide the imputation of the outcomes are pre-computed using the existing data from the original randomized experiment.

Usage

impute_success(
  current_data,
  imputation_info,
  id_col,
  success_col,
  prior_data = NULL,
  perfect_assignment,
  dates = NULL,
  success_date_col,
  current_period = NULL
)

Arguments

current_data

Updated tibble/data.frame object containing new treatments from assign_treatments().

imputation_info

A tibble/data.frame containing conditional probability of success by treatment block, for each combination that exists in current_data, calculated from the original experiment. Passed to randomizr::block_ra() to impute outcomes.

id_col

Column in data; contains unique ID as a key.

success_col

Column in data; binary successes from the original experiment.

prior_data

A tibble/data.frame containing all the data from previous periods. Used to join together at the end for the next iteration of the simulation.

perfect_assignment

Logical; if TRUE, assumes perfect information for treatment assignment (i.e., all outcomes are observed regardless of the date). If FALSE, hides outcomes not yet theoretically observed, based on the dates treatments would have been assigned for each wave. This is useful when simulating batch-based assignment where treatments were assigned on a given day whether or not all the information from a prior batch was available and you have exact dates treatments were assigned.

dates

Named date vector containing average success date by treatment block to impute new success dates for observations whose change in treatment also changes their outcome from failure to success.

success_date_col

Column in data; contains original dates each success occurred. Only necessary when perfect_assignment = FALSE. Must be of type Date, not a character string.

current_period

Numeric value of length 1; current treatment wave of the simulation.

Details

When perfect_assignment is FALSE, dates of success are imputed according to the average by each period and treatment block (treatment arm + any blocking). These imputations are required because these observations do not currently have dates of success, as no success was observed during the original experiment. Therefore if they go through the next iteration of the simulation without being imputed, the new successes will still be treated as failues becasue of the date masking mechanism.

Observations that were successful in the original experiment, got assigned a new treatment, and then imputed as success again, will have their original date kept. This assumes that the treatment has no individual treatment effect on the date of success, which may or may not be valid depending on the context of the experiment.

See Also

  • imputation_preparation()

  • imputation_precompute()

  • randomizr::block_ra()