American Roulette Payout


#1

What I am trying to do: In American roulette, the payout for winning on green is $17. This means that if you bet $1 and it lands on green, you get $17 as a prize.

The output I desire: Create a sampling model to predict winnings from betting on green.


#2

# Use the `set.seed` function to make sure your answer matches the expected result after random sampling.
set.seed(1)

# The variables 'green', 'black', and 'red' contain the number of pockets for each color
green <- 2
black <- 18
red <- 18

# Assign a variable `p_green` as the probability of the ball landing in a green pocket
p_green <- green / (green+black+red)

# Assign a variable `p_not_green` as the probability of the ball not landing in a green pocket
p_not_green <- 1 - p_green

#Create a model to predict the random variable `X`, your winnings from betting on green.
X <- sample(17,1,prob = p_green)      
#> Error in sample.int(x, size, replace, prob): incorrect number of probabilities

# Print the value of `X` to the console
X
#> Error in eval(expr, envir, enclos): object 'X' not found

#3

Having trouble defining the "X" random variable. Can someone hint me the correct syntax ? thanks


#4

the payout is either 17 or 0. So you really want to sample from a vector of 2 values: c(17,0)

try this:

sample(c(17,0),1,prob = c(p_green, 1-p_green)) 


#5

thats good advice. ill let ya know if it works. thanks


#6

The other thing to consider is sampling a draw from the list of possible outcomes with even odds:

n <- 1
sample(0:35,n, replace=TRUE) 

I think the range is 0:35... but you get the idea...

then you could set up a metadata table with columns: value, color, odd, even, etc

join your random draws to the metadata table to determine the characteristics of each draw.

I think you are just figuring this all out and are using gambling games as tractable examples. I think that's a great learning method.


#7

would this be valid: c(p_green,p_not_green) ?


#8

presuming they are defined, yes.


#9

I came across a new R ide from pgm-solutions. interested in the url ?


#10

RCode? Yep. It's a thing.


#11

yes, thats the one. i just installed it and will be trying it out. there is also a separate data science program there as well


#12

c(17, -1) is what worked for me. thanks