1
Introducing Reproducible Research
Research is typically presented in very selective containers: slideshows, journal articles, books, or websites. These presentation documents announce a projectās findings and try to convince us that the results are correct (Mesirov, 2010). Itās important to remember that these documents are not the research. Especially in the computational and statistical sciences, these documents are the āadvertisingā. The research is the āfull software environment, code, and data that produced the resultsā (Buckheit and Donoho, 1995; Donoho, 2010, 385). When we separate the research from its advertisement, we are making it difficult for others to verify the findings by reproducing them.
This book gives you the tools to dynamically combine your research with the presentation of your findings. The first tool is a workflow for reproducible research that weaves the principles of reproducibility throughout your entire research project, from data gathering to the statistical analysis, and the presentation of results. You will also learn how to use a number of computer tools that make this workflow easier and more robust. These tools include:
ā¢ the R statistical language that will allow you to gather data and analyze it;
ā¢ the LaTeX and Markdown markup languages that you can use to create documentsāslideshows, articles, books, and webpagesāfor presenting your findings;
ā¢ the knitr and rmarkdown packages for R and other tools, including command-line programs like GNU Make and Git version control, for dynamically tying your data gathering, analysis, and presentation documents together so that they can be easily reproduced;
ā¢ RStudio, a program that brings all of these tools together.
1.1 What Is Reproducible Research?
Though there is some debate over the necessary and sufficient conditions for a full replication (Makel and Plucker, 2014, 2), research results are generally considered1 replicable if there is sufficient information available for independent researchers to make the same findings using the same procedures with new data.2 For research that relies on experiments, this can mean a researcher not involved in the original research being able to rerun the experiment, including sampling, and validate that the new results are comparable to the original results. In computational and quantitative empirical sciences, results are replicable if independent researchers can recreate findings by following the procedures originally used to gather the data and run the computer code. Of course, it is sometimes difficult to replicate the original data set because of issues such as limited resources to gather new data or because the original study already sampled the full universe of cases. So as a next-best standard, we can aim for āreally reproducible researchā (Peng, 2011, 1226).3 In computational sciences4 this means:
the data and code used to make a finding are available and they are sufficient for an independent researcher to recreate the finding.
In practice, research needs to be easy for independent researchers to reproduce (Ball and Medeiros, 2011). If a study is difficult to reproduce, itās more likely that no one will reproduce it. If someone does attempt to reproduce this research, it will be difficult for them to tell if any errors they find were in the original research or problems they introduced during the reproduction. In this book, you will learn how to avoid these problems.
In particular, you will learn tools for dynamically āknittingā5 the data and the source code together with your presentation documents. Combined with wellorganized source files and clearly and completely commented code, independent researchers will be able to understand how you obtained your results. This will make your computational research easily reproducible.
1.2 Why Should Research Be Reproducible?
Reproducible research is one of the main components of science. If thatās not enough reason for you to make your research reproducible, consider that the tools of reproducible research also have direct benefits for you as a researcher.
Replicability has been a key part of scientific inquiry from perhaps the 1200s (Bacon, 1859; Nosek et al., 2012). It has even been called the ādemarcation between science and non-scienceā (Braude, 1979, 2). Why is replication so important for scientific inquiry?
Standard to judge scientific claims
Replication opens claims to scrutiny, allowing us to keep what works and discard what doesnāt. Science, according to the American Physical Society, āis the systematic enterprise of gathering knowledge ā¦ organizing and condensing that knowledge into testable laws and theoriesā. The āultimate standardā for evaluating scientific claims is whether or not the claims can be replicated (Peng, 2011; Kelly, 2006). Research findings cannot even really be considered āgenuine contributions to human knowledgeā until they have been verified through replication (Stodden, 2009b, 38). Replication ārequires the complete and open exchange of data, procedures, and materialsā. Scientific conclusions that are not replicable should be abandoned or modified āwhen confronted with more complete or reliable ā¦ evidenceā.6
Reproducibility enhances replicability. If other researchers are able to clearly understand how a finding was originally made, then they will be better able to conduct comparable research in meaningful attempts to replicate the original findings. Sometimes strict replicability is not feasible, for example, when it is only possible to gather one data set on a population of interest. In these cases reproducibility is a āminimum standardā for judging scientific claims (Peng, 2011).
It is important to note that though reproducibility is a minimum standard for judging scientific claims, āa study can be reproducible and still be wrongā (Peng, 2014). For example, a statistically significant finding in one study may remain statistically significant when reproduced using the original data/code, but when researchers try to replicate it using new data and even methods, they are unable to find a similar result. The original finding could have been noise, even though it is fully reproducible.
Avoiding effort duplication and encouraging cumulative knowledge development
Not only is reproducibility important for evaluating scientific claims, it can also contribute to the cumulative growth of scienti...