Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- great_wins1 <- rep(NA, 1000)
- great_wins2 <- rep(NA, 1000)
- ## run sim 1000 times to look at sample means
- for (j in 1:1000){
- ## run scenario 1 1000 times and extract sample mean
- ## for great players winning it all
- win_vec <- rep('none', 1000)
- for (i in 1:length(win_vec)){
- while (win_vec[i] == 'none'){
- win_vec[i] <- scenario1()
- }
- }
- great_wins1[j] <- length(which(win_vec == 'great'))
- ## run scenario 2 1000 times and extract sample mean
- ## for great players winning it all
- win_vec2 <- rep('none', 1000)
- for (i in 1:length(win_vec)){
- while (win_vec2[i] == 'none'){
- win_vec2[i] <- scenario2()
- }
- }
- great_wins2[j] <- length(which(win_vec2 == 'great'))
- }
- t.test(x = great_wins1, y = great_wins2, 'less')
- hist(great_wins1/length(great_wins1), xlab = 'Percentage of Great Player Wins: Scenario 1',
- main = 'Histogram of Win Percentage')
- hist(great_wins2/length(great_wins2), xlab = 'Percentage of Great Player Wins: Scenario 2',
- main = 'Histogram of Win Percentage')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement