make_game function

Play with a Discrete Random Variable

Play with a Discrete Random Variable

Makes a function that simulates a game based where your winnings are the sum of a specified number of plays of a discrete random variable with a specified distribution.

make_game(outcomes, probs, plays)

Arguments

  • outcomes: numerical vector of possible values of the random variable
  • probs: numerical vector giving the probability distribution
  • plays: number of times the random variable is simulated

Returns

a function of a single parameter n, with default value 1. n is the number of times you simulate the net winnings.

Examples

## Not run: play_game <- make_gmae( outcomes = c(-1, 0, 5) probs = c(0.4, 0.5, 0.1) plays = 2000 ) ## Play "plays" times, get net winnings: sampler() ## Play "plays" times again: sampler() ## Play "plays" times, a third time: sampler() ## 1000 more simulations of the net winnings: sampler(n = 1000) ## End(Not run)

Author(s)

Homer White hwhite0@georgetowncollege.edu

  • Maintainer: Homer White
  • License: GPL (>= 3)
  • Last published: 2020-06-15

Useful links