Guest User

Untitled

a guest
May 8th, 2021
75
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. p_vec <- seq(from = .6, to = .8, by = .025)
  2. great_wins3_mean <- rep(NA, length(p_vec))
  3. great_wins3 <- rep(NA, 500)
  4. for (k in 1:length(p_vec)){
  5.  
  6.   for (j in 1:500){
  7.  
  8.    ## run scenario 2 1000 times and extract sample mean
  9.     ## for great players winning it all
  10.     win_vec3 <- rep('none', 500)
  11.    
  12.     for (i in 1:length(win_vec3)){
  13.       while (win_vec3[i] == 'none'){
  14.         win_vec3[i] <- scenario3(p_vec[k])
  15.       }
  16.     }
  17.     great_wins3[j] <- length(which(win_vec3 == 'great'))
  18.   }
  19.   great_wins3_mean[k] <- mean(great_wins3)
  20. }
  21. plot(p_vec, great_wins3_mean/500, type = 'l', col = 'red', lwd = 3, ylab = 'Win Percentage of Great Player',
  22.      xlab = 'Good vs Bad Win Percent', main = 'Sensitivity Analysis')
  23. abline(h = mean(great_wins1) / length(great_wins1), col = 'blue', lty = 3, lwd = 3)
  24. legend('topright', legend = 'Baseline from Scenario 1', col = 'blue', lty = 3, lwd = 3)
RAW Paste Data