Reproducibility practices

Reproducibility practices

Practical habits that let others repeat and verify research, including version control, scripted analysis, fixed software environments, seeds, pre-registration, open data and code, and clear documentation.

What it is

Reproducibility practices are the habits, tools and documentation that make it possible for other people, and for your future self, to obtain the same results from the same data and analysis, and to check or build on them. Terminology varies, but a common usage (National Academies, 2019) is that reproducibility means obtaining consistent results using the same input data, computational steps, methods and code, while replicability means obtaining consistent results in a new study that collects new data to answer the same question. Robustness asks whether conclusions survive reasonable changes in analysis. Concern grew after surveys showed that a large share of researchers had failed to reproduce others’ work (a 2016 Nature survey reported over 70%).

It answers questions such as: Can I rerun my own analysis in six months, or on another computer? Can a reviewer or collaborator check my numbers? Which software versions and settings produced this figure? How can I show that the hypothesis was fixed before seeing the data? Good practice raises the reliability of results, speeds up work and increases trust and citations.

Fundamentals

Organize, script and document the analysis

Treat the analysis as a pipeline from raw data to final results that runs without manual steps. Keep raw data read-only and separate from processed data; do all cleaning, transformation, statistics and plotting in scripts or notebooks (R, Python, Julia, MATLAB), never by hand in a spreadsheet, so the steps are recorded. Use a clear, standard project structure (folders for data, code, results and documentation), meaningful file names, and a README that explains the purpose, how to run the code, the files and the contacts. Use a build or workflow tool (Make, Snakemake, Nextflow, targets, DVC) so that the whole analysis reruns with one command and re-executes only what changed. Literate programming (Quarto, Jupyter, R Markdown) combines code, results and explanation, but notebooks need care: run them top to bottom in a fresh session before sharing, since out-of-order execution hides errors. Comment the why, write small testable functions, add unit tests and sanity checks, and apply code review where possible. Record decisions about excluded data and analytic choices, with reasons.

Version control, environments and randomness

Version control with Git (hosted on GitHub, GitLab or similar) records every change with an explanation, allows collaboration and recovery, and, with tags or releases, ties a paper’s results to an exact code version. Large data go in dedicated storage with checksums. Fix the computational environment: list package versions with a lock file (renv, conda environment.yml, pip requirements or poetry.lock), or package everything in a container (Docker or Apptainer/Singularity) or a reproducible environment (Nix, Guix, Binder, Code Ocean) so that the same software stack runs anywhere; record the operating system, hardware where relevant (GPU results can differ), and compiler options. Control randomness by setting and recording random seeds for simulations, bootstrap, data splits and machine-learning training, and report results across several seeds, since exact bitwise reproducibility is sometimes impossible (parallelism, floating-point order, nondeterministic GPU operations) and the aim is then statistical reproducibility.

Study design, pre-registration and transparency

Reproducibility concerns design as well as code. Plan sample size by power analysis, define primary outcomes and analyses before data collection, and use pre-registration (on OSF, AsPredicted, ClinicalTrials.gov or similar) to separate confirmatory from exploratory analyses; Registered Reports have the journal review the plan before results are known, reducing publication bias. Guard against questionable research practices: p-hacking (trying analyses until p < 0.05), HARKing (hypothesizing after results are known), selective reporting, and the garden of forking paths, in which many reasonable analytic choices inflate false positives. Report all outcomes, effect sizes with confidence intervals and negative results, and use multiverse or sensitivity analyses to show robustness. Follow reporting guidelines (CONSORT, STROBE, ARRIVE, PRISMA, TRIPOD) and the TOP (Transparency and Openness Promotion) guidelines. Blind analysts where feasible and use independent validation or hold-out data (see train, validation and test splits).

Sharing and long-term preservation

Share code, data and materials in trusted repositories (Zenodo, Figshare, OSF, Dryad, domain repositories), with a persistent identifier (DOI), a clear license (MIT or Apache for code; CC BY or CC0 for data), and metadata that follow the FAIR principles (see research data management and FAIR). Deposit the exact version used in the paper and cite it. A data and code availability statement should say what is shared and, if not, why (privacy, copyright, size), offering alternatives such as synthetic data, a restricted-access arrangement or a code-only release. Reproducible research is also a matter of time: archives and containers should be tested periodically, because software and links decay. Aim for a “reproducibility check” by a colleague who has not seen the project, who tries to reproduce the key figures from the README alone.

Typical applications and limits

Limits: full reproducibility can be costly, some data cannot be shared, tools become obsolete, and reproducing a result does not make it correct, since a reproducible analysis can still be biased or conceptually wrong.

Basic operation

  1. Set up the project. Create a standard folder structure, a README and a Git repository.
  2. Preserve raw data. Store originals read-only with checksums and metadata.
  3. Script every step. Clean, analyze and plot with code, not manual edits.
  4. Fix the environment and seeds. Record package versions or use a container, and set random seeds.
  5. Pre-register the plan. Specify hypotheses and analyses before seeing outcomes where appropriate.
  6. Test and rerun. Execute the whole pipeline from scratch on a clean machine.
  7. Share and archive. Deposit code and data with a DOI and a license.
  8. Collect the output. You obtain a project others can rerun to regenerate every figure; containers and workflow tools are covered in the video.

Good practice

  • Never edit raw data by hand. Change it only through scripts.
  • Commit often. Write messages that explain changes.
  • Pin your software versions. “Works on my machine” is not reproducible.
  • Separate confirmatory from exploratory work. Label them clearly.
  • Test on a fresh machine. Ask a colleague to run it.
  • Share responsibly. Remove personal and sensitive information before publishing, respect consent, licenses and agreements with data owners, and do not publish credentials or keys inside repositories.

Key terms

  • Reproducibility — obtaining the same results from the same data and code.
  • Replicability — obtaining consistent results in a new study with new data.
  • Pre-registration — a time-stamped plan filed before data analysis.
  • Version control — a system that records and manages changes to files over time.
  • Container — a packaged software environment that runs identically on different machines.
  • p-hacking — trying analytic options until a significant result appears.
  • Random seed — a value that fixes a pseudo-random number sequence for repeatability.

Video coming soon

About five minutes on Reproducibility practices: how it works in detail, how the data is acquired, and how it is analyzed.

Shopping cart

0
image/svg+xml

No products in the cart.

Continue Shopping