I chose to use a Binomial Distribution to develop my model since the binomial distribution is used to describe the number of successes in a fixed number of trials.
For three trials, there are four outcomes:
success <- 0:3
odds <- dbinom(success, size = 3, prob=.474)
value <- c(-3,-1,1,3)
winnings <- c("-3$", "-1$", "1$","3$")
pocket_amt <- c("-3$", "2$", "4$","6$")
roulette <- data.frame(pocket_amt,winnings,value,odds)
kable(roulette, "html") %>% kable_styling("striped") %>% scroll_box(width = "100%", height = "100%")
| pocket_amt | winnings | value | odds |
|---|---|---|---|
| -3$ | -3$ | -3 | 0.1455316 |
| 2$ | -1$ | -1 | 0.3934333 |
| 4$ | 1$ | 1 | 0.3545387 |
| 6$ | 3$ | 3 | 0.1064964 |
barplot(roulette$odds, main = "Binomoal Distribution for Betting on Red for Three Roulette Spins",
names.arg=c(winnings))
roulette[,3:4] <- sapply(roulette[,3:4], as.numeric)
win <- roulette %>% filter(value >0) %>% summarise(odds = sum(odds))
lose <- roulette %>% filter(value < 0) %>% summarise(odds = sum(odds))
odds <- rbind(win,lose)
outcome <-rbind("win", "lose")
win_lose <- cbind(outcome, odds)
kable(win_lose, "html") %>% kable_styling("striped") %>% scroll_box(width = "100%", height = "100%")
| outcome | odds |
|---|---|
| win | 0.4610352 |
| lose | 0.5389648 |
roulette[2] <- sapply(roulette[2], as.numeric)
win_lose <- win_lose %>% mutate(total = (odds * 100))
bp<- ggplot((win_lose), aes(x=NA, y=total, fill=outcome))+
geom_bar(width = 1, stat = "identity")
pie <- bp + coord_polar("y", start=0)
pie + scale_fill_grey() + theme_minimal()