Skip to content
Create a gist now

Instantly share code, notes, and snippets.

3 Point Shooting
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
Something went wrong with that request. Please try again.