Skip to content

Instantly share code, notes, and snippets.

@jtleek
Created August 19, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jtleek/399b0e32e791c52357fc to your computer and use it in GitHub Desktop.
Save jtleek/399b0e32e791c52357fc to your computer and use it in GitHub Desktop.
Any p-value significant example
## Load library/set seed
set.seed(1325)
library(qvalue)
library(RSkittleBrewer)
trop = RSkittleBrewer("tropical")
## Set a target p-value
target_pval = 0.8
## Not significant if we
## test with a set of uniform p-values
otherpvals = runif(1000)
pvals = c(target_pval,otherpvals)
hist(pvals,col=trop[2],xlab="P-value",main="",breaks=20)
qvalue(pvals)$qvalue[1]
## But if we make all the
## other p-values really significant
## then whoa!
otherpvals = rbeta(1000,1,30)
pvals = c(target_pval,otherpvals)
hist(pvals,col=trop[2],xlab="P-value",main="")
qvalue(pvals)$qvalue[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment