Skip to content

Instantly share code, notes, and snippets.

@jacquesattack
Created April 8, 2015 21:52
Show Gist options
  • Save jacquesattack/d525258d06cd78c7a8f2 to your computer and use it in GitHub Desktop.
Save jacquesattack/d525258d06cd78c7a8f2 to your computer and use it in GitHub Desktop.
Calibrated p-values for testing precise null hypotheses
# Calibrated p-values
# -------------------
# See https://stat.duke.edu/courses/Spring10/sta122/Labs/Lab6.pdf
# and http://www.uv.es/sestio/TechRep/tr14-03.pdf
alpha.p = function(p){
val = 1 + (-exp(1)*p*log(p))^-1
return(val^-1)
}
# Curve over all pvalues
curve(alpha.p(x),0,1,ylab="alpha(p)",xlab="p")
# Curve over interesting pvalues
curve(alpha.p(x),0,.1,ylab="alpha(p)",xlab="p")
abline(v=0.05,lty=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment