Skip to content

Instantly share code, notes, and snippets.

@jtleek
Last active August 29, 2015 14:01
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 jtleek/deb7a98644ebd19757b1 to your computer and use it in GitHub Desktop.
Save jtleek/deb7a98644ebd19757b1 to your computer and use it in GitHub Desktop.
Code to create p-value histograms of significant p-values in journal abstracts for JAMA, NEJM, BMJ, Lancet, and AJE 2000-2010
## See the paper by Jager and Leek and associated discussion
## for more information: http://biostatistics.oxfordjournals.org/content/15/1/1
## For the code to perform the analysis in that paper or to see how the p-values
## were collected see the repo: https://github.com/jtleek/swfdr
## The data for this gist are available here:
## https://github.com/jtleek/swfdr/blob/master/pvalueData.rda
## Load packages
library(ggplot2)
## Load data
load("pvalueData.rda")
## Make a data frame
pvalueData <- as.data.frame(pvalueData)
## Make pvalue data numeric
pvalueData$pvalue = as.numeric(as.vector(pvalueData$pvalue))
## Add journal names
pvalueData$journal = rownames(pvalueData)
## Subset to significant p-values
pval05 = pvalueData[pvalueData$pvalue < 0.05,]
## Make a plot
qplot(factor(journal), pvalue, data = pval05, geom = "violin",fill=journal)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment