Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p_vec <- seq(from = .6, to = .8, by = .025)
- great_wins3_mean <- rep(NA, length(p_vec))
- great_wins3 <- rep(NA, 500)
- for (k in 1:length(p_vec)){
- for (j in 1:500){
- ## run scenario 2 1000 times and extract sample mean
- ## for great players winning it all
- win_vec3 <- rep('none', 500)
- for (i in 1:length(win_vec3)){
- while (win_vec3[i] == 'none'){
- win_vec3[i] <- scenario3(p_vec[k])
- }
- }
- great_wins3[j] <- length(which(win_vec3 == 'great'))
- }
- great_wins3_mean[k] <- mean(great_wins3)
- }
- plot(p_vec, great_wins3_mean/500, type = 'l', col = 'red', lwd = 3, ylab = 'Win Percentage of Great Player',
- xlab = 'Good vs Bad Win Percent', main = 'Sensitivity Analysis')
- abline(h = mean(great_wins1) / length(great_wins1), col = 'blue', lty = 3, lwd = 3)
- legend('topright', legend = 'Baseline from Scenario 1', col = 'blue', lty = 3, lwd = 3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement