coin_flip_game: Single coin flip game allowing multiple coins

Description Usage Arguments Value Examples

View source: R/coin_flip.R

Description

Each coin is given a probability of a success, independent of other coins. Ties are dealt with by recursion, though I barely understand how I got this to work. If all coins return 1 or all coins return 0 (an all-way tie), simply repeat the flip; nothing has changed. If any coins come out ahead, partition the different coins by 'rank' (rank 1 means a coin succeeded while others did not) and recursively run the simulation until all ties have been broken and each coin has been assigned a unique rank, 1 through N.

Usage

1

Arguments

thetas

Vector of probabilities of success for each coin

Value

A vector of ranks for each probability in thetas

Examples

1
example_game <- coin_flip_game(c(0.5, 0.5, 0.7))

tomshafer/bcf documentation built on May 18, 2019, 9:14 p.m.