whatifbandit0.3.0 package

Analyzing Randomized Experiments as Multi-Arm Bandits

adaptive_aipw

Calculate Adaptive AIPW Estimates

assign_treatments

Adaptively Assign Treatments in a Period

bandit_invalid

Checks Validity of Thompson sampling probabilities

check_assign_method

Checking For Valid Assignment Methods

check_cols

Checking existence and declaration of columns

check_data

Checking for Valid Input Data

check_impute

Checking Imputation Info

check_level

Check Level

check_logical

Checking if Inputs are Logical Values (TRUE and FALSE)

check_posint

Checking If Inputs Are Positive Integers or a Valid String

check_prop

Checking for Proportions

cols

Column arguments shared across functions

condense_results

Condenses results into a list for multiple_mab_simulation()

create_conditions

Creating proper conditions vector

create_cutoff

Create Treatment Wave Cutoffs

create_new_cols

Create Necessary Columns for Multi-Arm Bandit Trial

create_prior

Create Prior Periods

end_mab_trial

Ends Multi-Arm Bandit Trial

get_assignment_quantitites

Calculates Number of Observations Assigned to Each Treatment

get_bandit

Calculate Multi-Arm Bandit Decision Based on Algorithm

get_bandit.thompson

Thompson sampling Algorithm

get_bandit.ucb1

UCB1 Sampling Algorithm

get_iaipw

Calculate Observation Level AIPW For Each Treatment Condition

get_past_results

Gather Past Results for Given Assignment Period

imputation_precompute

Precomputing Key Values for Outcome Imputation

imputation_preparation

Outcome Imputation Preparation

impute_success

Imputing New Outcomes of Multi-Arm-Bandit Trial

mab_simulation

Simulates Multi-Arm Bandit Trial From Prepared Inputs

multiple_mab_simulation

Run Multiple Multi-Arm-Bandit Trials with Inference in Parallel

plot_arms

Plot Treatment Arms Over Time

plot_assign

Plot Cumulative Assignment Probability Over Time

plot_estimates

Plot AIPW Estimates

plot_hist

Plots Histograms of multiple_mab_simulation() Results

plot_mult_estimates

Plots AIPW Confidence Intervals

plot_summary

Plot Treatment Arms Over Multiple Trials

plot.mab

Plot Generic for mab objects

plot.multiple.mab

Plot Generic For multiple.mab Objects

pre_mab_simulation

Pre-Simulation Setup for an adaptive Multi-Arm-Bandit Trial

print_mab

Print Helper for mab and multiple.mab

print.mab

Print Generic For mab

print.multiple.mab

Print Generic For multiple.mab

run_mab_trial

Runs Multi-Arm Bandit Trial

single_mab_simulation

Run One Adaptive Simulation With Inference.

summary.mab

Summary Generic For "mab" Class

summary.multiple.mab

Summary Generic For "multiple.mab" Class

validate_inputs

Validates Inputs For single_mab_simulation() and `multiple_mab_simul...

verbose_log

Verbose Printer

whatifbandit-package

whatifbandit: Analyzing Randomized Experiments as Multi-Arm Bandits

Simulates the results of completed randomized controlled trials, as if they had been conducted as adaptive Multi-Arm Bandit (MAB) trials instead. Augmented inverse probability weighted estimation (AIPW), outlined by Hadad et al. (2021) <doi:10.1073/pnas.2014602118>, is used to robustly estimate the probability of success for each treatment arm under the adaptive design. Provides customization options to simulate perfect/imperfect information, stationary/non-stationary bandits, blocked treatment assignments, along with control augmentation, and other hybrid strategies for assigning treatment arms. The methods used in simulation were inspired by Offer-Westort et al. (2021) <doi:10.1111/ajps.12597>.

  • Maintainer: Noah Ochital
  • License: GPL (>= 3)
  • Last published: 2025-11-03