Skip to content

Instantly share code, notes, and snippets.

@GabrielHoffman
Created July 30, 2020 15:27
Show Gist options
  • Save GabrielHoffman/9048d37c89d8f7b6aac72ff1f28d8ad0 to your computer and use it in GitHub Desktop.
Save GabrielHoffman/9048d37c89d8f7b6aac72ff1f28d8ad0 to your computer and use it in GitHub Desktop.
library(qvalue)
p = runif(1000, 0, 1)
# compute pi0, the fraction of tests where the null is supported
# so pi1 = 1-p0 is the fraction of tests where the null is rejected
# This method doesn't depend on p-value cutoffs and works even of nothing
# is genome-wide significant
pi1 = 1 - qvalue(p)$pi0
# Here pi is near zero because the p-values are uniform
pi1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment