Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N <- 10000
- S <- sum(runif(N)<0.5)
- S/(S+0.5*(N-S))
- N <- 10^6
- ballsinboxes <- c("G","G", "G","S", "S","S")
- selectedbox <- sample(c(1,2,3), N, replace=TRUE)
- selectedball <- sample(c(1,2), N, replace=TRUE)
- selectedcolour <- ballsinboxes[(selectedbox-1)*2 + selectedball ]
- othercolour <- ballsinboxes[(selectedbox-1)*2 + 3 - selectedball ]
- sum(selectedcolour == "G" & othercolour == "G") / sum(selectedcolour == "G")
Add Comment
Please, Sign In to add comment