Created
November 7, 2012 23:42
-
-
Save cdesante/4035412 to your computer and use it in GitHub Desktop.
3 Point Shooting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment