public
Created

3 Point Shooting

  • Download Gist
confidence.r
R
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
N <- 1:3
SE <- c(.272, .19, .16)
HI <- c(1.2, 1.0, .98)
LO <- c( .13, .29, .36)
AVG <- c(.667, .667, .667)
Shots <- c(1,0,1)
for (i in 4:50) {
Shots[i] <- sample(c(1,0,1), 1)
N[i] <- i
SE[i] <- sqrt(mean(Shots)/N[i])
HI[i] <- mean(Shots) + 1.96 * SE[i]
LO[i] <- mean(Shots) - 1.96 * SE[i]
AVG[i] <- mean(Shots)
}
 
 
qplot(N, AVG, ymin=LO, ymax=HI, geom="pointrange", colour=-AVG, size=I(.9)) +theme_bw() + scale_colour_gradientn(colours=c("red", "blue")
) + geom_hline(y=.43) +labs(title = "Your Recruit Over 50 Shots \n") + ylab("Pct 3pt Shot Made \n")
N <- 1:3
SE <- c(.272, .19, .16)
HI <- c(1.2, 1.0, .98)
LO <- c( .13, .29, .36)
AVG <- c(.667, .667, .667)
Shots <- c(1,0,1)
for (i in 4:500) {
Shots[i] <- sample(c(1,0,1), 1)
N[i] <- i
SE[i] <- sqrt(mean(Shots)/N[i])
HI[i] <- mean(Shots) + 1.96 * SE[i]
LO[i] <- mean(Shots) - 1.96 * SE[i]
AVG[i] <- mean(Shots)
}
 
 
qplot(N, AVG, ymin=LO, ymax=HI, geom="pointrange", colour=-AVG, alpha=.5, size=I(.9)) +theme_bw() + scale_colour_gradientn(colours=c("red", "blue")
) + geom_hline(y=.43) +labs(title = "Your Recruit Over 500 Shots \n") + ylab("Pct 3pt Shot Made \n")

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.