Thompson sampling Algorithm
# S3 method for thompson
get_bandit(past_results, conditions, current_period, ndraws)A named list of length 2, where element 1 is the named numeric vector of Thompson
sampling probabilities, and element 2 is a reference to the same vector. The second element is
adjusted later in the simulation based on what the user has set for control_augment and random_assign_prop to reflect the
probability of assignment to a given treatment at that period.
A tibble/data.table containing summary of prior periods, with
successes, number of observations, and success rates, which is created by get_past_results().
Numeric value of length 1; current period of the adaptive trial simulation.
A numeric value; When Thompson sampling direct calculations fail, draws from a simulated posterior
will be used to approximate the Thompson sampling probabilities. This is the number of simulations to use, the default
is 5000 to match the default parameter bandit::best_binomial_bandit_sim(), but might need to be raised or lowered depending on performance and accuracy
concerns.
Thompson sampling is calculated using the bandit package but the direct calculation can fail. If this occurs, a simulation based method is used instead to estimate the posterior distribution, and the user receives a warning.