Preventing statistical reporting errors by integrating writing and coding
tl;dr: Using RMarkdown with knitr is a nice way to decrease statistical reporting errors. How often are there statistical reporting errors in published research? Using a new automated method for scraping APA-formatted stats out of PDFs, Nuijten et al. (2015) found that over 10% of p-values were inconsistent with the reported details of the statistical test, and 1.6% were what they called "grossly" inconsistent, e.g. difference between the p-value and the test statistic meant that one implied statistical significance and the other did not (another summary here ). Here are two key figures, first for proportion inconsistent by article and then for proportion of articles with an inconsistency: These graphs are upsetting news. Around half of articles had at least one error by this analysis, which is not what you want from your scientific literature.* Daniel Lakens has a nice post suggesting that three errors account for many of the problems: incorrect use of < ins...