Skip to content

Instantly share code, notes, and snippets.

@hillarysanders
Last active January 10, 2017 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hillarysanders/7131b1c6d7e3fe1b67fb2bb8223f8aea to your computer and use it in GitHub Desktop.
Save hillarysanders/7131b1c6d7e3fe1b67fb2bb8223f8aea to your computer and use it in GitHub Desktop.
simulate.bad.test.for.reddit = function(j){
accuracy = c()
head_injuries = c(rep(TRUE, 12), rep(FALSE, 17))
for(i in 1:174){
guesses = sample(c(TRUE, FALSE), size=12+17, replace=TRUE)
accuracy = c(mean(guesses==head_injuries), accuracy)
}
return(max(accuracy))
}
x = sapply(1:10000, simulate.bad.test.for.reddit)
hist(x, breaks=50, col='cornflowerblue',
main='Best (0 actual predictive power) Metabolite "Accuracy"')
print(quantile(x))
# simulation gives:
# 0% 25% 50% 75% 100%
# 0.6551724 0.7241379 0.7586207 0.7586207 0.8965517
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment