Learn R Programming

whatifbandit (version 0.3.0)

condense_results: Condenses results into a list for multiple_mab_simulation()

Description

Takes the output from furrr::future_map() in multiple_mab_simulation() and condenses it to return to the user.

Usage

condense_results(data, keep_data, mabs, times)

Value

multiple.mab class object, which is a named list containing:

  • final_data_nest: tibble or data.table containing the nested tibbles/data.tables from each trial. Only provided when keep_data is TRUE.

  • bandits: A tibble or data.table containing the UCB1 values or Thompson sampling posterior distributions for each period. Wide format, each row is a period, and each columns is a treatment.

  • assignment_probs: A tibble or data.table containing the probability of being assigned each treatment arm at a given period. Wide format, each row is a period, and each columns is a treatment.

  • estimates: A tibble or data.table containing the AIPW (Augmented Inverse Probability Weighting) treatment effect estimates and variances, and traditional sample means and variances, for each treatment arm. Long format, treatment arm, and estimate type are columns along with the mean and variance.

  • settings: A named list of the configuration settings used in the trial.

Arguments

data

A data.frame, data.table, or tibble containing input data from the trial. This should be the results of a traditional Randomized Controlled Trial (RCT). Any data.frames will be converted to tibbles internally.

keep_data

Logical; Whether or not to keep the final data from each trial. Recommended FALSE.

mabs

output from furrr::future_map() in multiple_mab_simulation()

times

A numeric value of length 1, the number of simulations to conduct.

Details

This function iterates over every element in the output from furrr::future_map() and extracts the required element to place to condense into the final list, outputted to the user in multiple_mab_simulation. It condenses the long list into tibbles or data.tables, keeping each element together. For example it extracts all the bandits objects from the output lists, across all trials, and binds them into a single tibble/data.table.