Research question

A monthly analysis has 36 monthly records, one of which has a missing value. The author drops the missing month, keeps 35 rows, and reports a mean of 4.2% and a median of 4.1%. Another analyst handles the same month in a spreadsheet and gets a mean of 4.3%. The gap is 0.1 percentage points, but a reader cannot tell which rule was used. The question is what a minimum reproducible workflow needs, how to verify that someone else can recompute the result, and what reproducibility cannot guarantee.

Data

Suppose a small monthly project with a read-only raw file and scripted analysis.

Artifact Definition Unit Frequency Period Example (hypothetical) License
Raw file Read-only, with source and hash Rows Monthly 36 months 36 rows × 3 columns Not applicable
Clean data Missing values handled per the decision log Rows Monthly Same period 35 rows Not applicable
Code and environment Script plus pinned dependencies Files Each run Same period 1 script + 1 lockfile Not applicable
Results table Mean, median, sample size % or rows Each run Same period 4.2 / 4.1 / 35 Not applicable

Method and assumptions

Stages: acquire, clean, analyse, validate, archive. Acquisition saves the raw file, source, date, licence and hash, and never overwrites it. Cleaning scripts handle missing values, outliers and transformations; every deletion, imputation or recode goes into a decision log, and outputs go to a separate directory. Analysis reads only clean data and writes the results table. Validation checks row counts, missingness, summary statistics and expected outputs, with unit and end-to-end tests for key calculations. Archiving pins the code, data version, dependencies and run command. Code and documentation go under version control; data and credentials do not. Record the system, language, package versions and random seeds, run every step with one command, and check before each merge. The key assumptions: raw data were not modified, scripts cover every manual step, dependencies can be rebuilt, and outputs are documented. If any fails, “reproducible” means only “it ran on my machine”. The checklist below is a synthesis of common practice, not a description of this site's pipeline. Our snapshots record input byte size, SHA-256 and retrieval time, and derived output lives under data/snapshots//; a missing value makes a script fail rather than entering a decision log. The site has no run.sh and no unit or end-to-end tests of the numeric calculations; existing checks cover register consistency and page behaviour. Do not read this checklist as something the site already does.

Results

The raw file has 36 rows and the clean file 35; the table reports a mean of 4.2%, a median of 4.1% and n = 35. A clean-environment rerun using the README and lockfile reproduces the same table and checksums in about 12 seconds. The spreadsheet gives a mean of 4.3% because it uses a different missing-month rule; the code is not wrong, but the rule is invisible. Reproducibility comes from the chain of data, code, environment, documentation and validation.

The reproducibility chain from raw files to result table Three boxes joined left to right by arrows. The first holds the raw file, thirty-six rows by three columns with source and hash; the second the cleaned data, thirty-five rows with missing-data decisions logged; the third the result table, 4.2 mean, 4.1 median and n of 35. A note below records that the script and dependency lock are stored with every run. Reproducibility chain (teaching example) raw file 36 × 3 cleaned data 35 rows results 4.2 / 4.1 / 35 source + SHA-256 rules in decision log mean / median / n alongside: 1 analysis script + 1 dependency lock per run
Figure 1: the teaching chain - a read-only raw file of 36 rows × 3 columns with a hash, 35 rows after logged missing-data decisions, and a result table of mean 4.2, median 4.1 and n = 35, with the script and dependency lock saved at every run. Box sizes show the order of stages only and carry no scale.; sample: the article’s own argument; units as stated in the text.

Robustness

Rebuild dependencies in a clean environment and rerun; delete an input, rename a column or change a unit (for units and statistical definitions see the main article Data Units and Statistical Definitions, RES-001) to confirm the pipeline fails clearly; compare outputs by checksum; ask someone who did not build the analysis to rerun from the README. If outputs differ, check the data version, missing-data rule, software version and rounding before changing the conclusion. Failure conditions: manual edits, undocumented filters, post-publication revisions, dependency drift and licence limits.

Limitations

Reproducible is not correct: the same pipeline can reliably reproduce a biased sample, a wrong definition or a wrong model. Confidential data may be rerunnable only by trusted users, and public reproduction may be licence-limited. Software decays, and documentation can omit steps. The numbers are hypothetical and do not describe a real project.

Reproduction

A suggested layout: data/raw/, data/clean/, src/ and outputs/, with README.md, environment.lock and run.sh at the root. The README records source, access date, licence, version or hash, run command, expected outputs, runtime and limitations; run.sh runs cleaning, analysis, tests and checks with one command; the results table carries a generation time and input hash.

The ONS guidance treats version control, testing, peer review, data management and automation as components of a reproducible pipeline: version control keeps an audit trail of changes, testing checks that the code does what it should and can be run again, peer review checks the analysis is fit for purpose, and automation runs the tests before each merge [1].

The NIST Research Data Framework defines reproducibility as repeating the analysis using the same tools and materials — documented metadata, code and data [2].

Strength of conclusions

A documented workflow lets another analyst recompute it, but does not prove the sample representative, the method right or the conclusion causal. “Reproducible” answers “can it be recomputed”; “valid” answers “should it be believed”, and the two claims are separate. The 36 rows, 35 rows, 4.2%, 4.1%, 4.3% and about 12 seconds are all hypothetical.

Knowledge-point review

application programming interfaces

Definition: An API is a programmatic interface to a data service, defining endpoints, parameters, authentication, pagination and rate limits.

Mechanism: APIs use keys, quotas and formats; pagination, retries and caching affect completeness and cost, and version changes can break pipelines.

Example: For example, a REST API pulls prices by date and ticker with token authentication and paging.

Boundary: An API is not a stable database; throttling, field changes, outages and revoked access cause gaps, and real-time and revision conventions differ, so calls and errors must be logged.

data files

Definition: Data files are structured storage such as CSV, JSON, Parquet, Excel and database exports.

Mechanism: Format affects types, compression, speed and schema; encoding, delimiters and nesting cause parsing errors.

Example: For example, CSV is readable but loses types, Parquet is columnar and compressed for large data, and JSON suits nesting.

Boundary: A file is not a neutral container; encoding, formula injection, hidden rows and conversion change data, Excel truncates precision, and schema and encoding checks are needed.

data cleaning

Definition: Cleaning fixes types, duplicates, missing values, formats, units and outliers so data can be analysed.

Mechanism: It includes standardising dates and codes, deduplication, missing handling, unit conversion and outlier flags; rules should be reproducible and documented.

Example: For example, converting “1,234 yuan” to 1234 and unifying tickers and date formats.

Boundary: Cleaning is not arbitrary editing; over-cleaning removes real extremes, imputation invents information, inconsistent rules create incomparable data, and raw data should be preserved.

data validation

Definition: Validation checks whether data satisfy schema, ranges, uniqueness, completeness and cross-source consistency.

Mechanism: Rules include types, non-null, primary-key uniqueness, value ranges and reconciliation; failures should block or alert, not pass silently.

Example: For example, prices are non-negative, dates unique, and turnover roughly matches volume times price.

Boundary: Validation is not one-time; loose rules miss errors, strict rules block valid data, cross-source conflicts need precedence, and validation cannot catch semantic errors.

data versioning

Definition: Versioning records the state of data, code and configuration over time for reproducibility, rollback and audit.

Mechanism: Snapshots, hashes, timestamps and repositories can version; point-in-time data also needs revisions and availability timing.

Example: For example, saving daily price snapshots with code commits reproduces a backtest.

Boundary: Versioning is not simple backup; storage, retention and privacy matter, overwrites lose history, and inconsistent versions cause look-ahead and irreproducibility.

automated updates

Definition: Automated updates pull, clean, validate and load data on schedule or events to keep it current.

Mechanism: Updates need incremental logic, idempotency, retries, alerts and backfills; scheduling depends on release calendars and upstream availability.

Example: For example, after each close prices load automatically, failures alert and retry, and missing days are backfilled.

Boundary: Automation is not unattended; upstream changes, time zones and holidays create gaps, duplicate writes corrupt data, and silent failure is worse than downtime.

scripts and reproducibility

Definition: Scripts encode data acquisition, cleaning, analysis and output as repeatable code with parameters, logging and error handling.

Mechanism: Scripts should be idempotent, configurable, log inputs and outputs and set seeds; version control and tests ensure reproducibility.

Example: For example, a script pulls a date range, cleans and reports, producing the same result on rerun.

Boundary: Scripts are not one-off code; hard-coded paths, hidden state and missing logs break reproducibility, and randomness and external dependencies change output.

configuration and dependencies

Definition: Configuration is external parameters such as paths, dates, API keys and model settings; dependencies are libraries, versions and system environment.

Mechanism: Config should be separate from code, secrets stored in environment or managers, dependencies locked, and environments reproduced with containers or virtualenvs.

Example: For example, an .env file stores API keys and a lockfile pins pandas.

Boundary: Configuration is not minor; hard-coded keys leak, dependency drift changes results, environment differences and unpinned versions cause “works on my machine” failures.

Related

  • Required prerequisite: Data Units and Statistical Definitions (RES-001).
  • Related reading: Frequency and Time Alignment (RES-003), Seasonal Adjustment and Revisions (RES-004).

Figures in plain language

The three figures below check the mechanism, boundary and comparison in this article; labels come from its own sections, not new data.

A Reproducible Research Workflow: mechanism chain A Reproducible Research Workflow — three-step structure: problem, mechanism, judgment. Labels come from the article's sections, not new data. A Reproducible Research Workflow: mechanism chain Labels come from the article's sections; all three steps matter. Problem Reproducibility is not “the code… Reproducibility is not “the code ran once”; it means another person can… Reproduction Reproduction: A suggested layout… Reproduction: A suggested layout: data/raw /, data/clean/, src/ and outputs… Data Suppose a small monthly project… Suppose a small monthly project with a read-only raw file and scripted analysi… Reading order: test the problem, then the mechanism, then whether the judgment overreaches. If a middle step lacks evidence, later conclusions are hypotheses, not facts. Structural illustration, not a new data chart; sample is the article's own argument.
Figure 2: A Reproducible Research Workflow — mechanism chain: problem, mechanism, judgment. Sample: the article's own argument; units as stated in the text.
A Reproducible Research Workflow: boundary Separates conditions where the claim holds from those where it fails; a local example is not universal. A Reproducible Research Workflow: when does it hold? Check the conditions before the conclusion If conditions, definitions or samples change, recompute the conclusion Holds Reproducible is not correct: the same pipeline can reliably reproduce a biased sample, a wrong… Fails / rewrite A monthly analysis has 36 monthly records, one of which has a missing value. Boundary illustration; sample is the article's own argument; units as stated in the text.
Figure 3: A Reproducible Research Workflow — boundary: when the claim holds, and when it fails. Sample: the article's own argument; units as stated in the text.
A Reproducible Research Workflow: object, conditions and common mistakes Three rows compare the concept, its conditions and common mistakes; comparison is not equivalence and does not replace a definition. A Reproducible Research Workflow: object, conditions and common mistakes at a glance This article Commonly confused Object Reproducibility is not “the code ran… Adjacent concepts / common claims Conditions Reproducible is not correct: the same… A monthly analysis has 36 monthly records, one of which… Check Define first, then compare; never judge labels only Correlation is not causation; a local case is not universal Comparison illustration; sample is the article's own argument; units as stated in the text.
Figure 4: A Reproducible Research Workflow — comparison of object, conditions and common mistakes. Sample: the article's own argument; units as stated in the text.

Exercises

  1. A script overwrites data/raw.csv on every run. What is wrong, and how should it be changed?
  2. What should a README record so someone else can rerun the analysis?
  3. A rerun matches the paper's table but uses a different missing-data rule. Is that reproducible? How should it be reported?
Suggested answers
  1. Raw data should be read-only; the script should write to a derived directory such as data/clean/ and keep the raw hash. Overwriting destroys the audit trail and hides which data version produced the result.
  2. Data source and access date, licence, version or hash, dependency versions, run command, expected outputs, runtime and known limitations.
  3. It is computationally repeatable but inconsistent with the documented method; record the rule, explain the difference, and recompute the paper's result.

Sources

  1. Office for National Statistics. “Quality assurance of code for analysis and research.” Open Government Licence v3.0. https://best-practice-and-impact.github.io/qa-of-code-guidance/intro.html (accessed 2026-10-30)
  2. National Institute of Standards and Technology. “NIST Research Data Framework (RDaF), NIST SP 1500-18r2.” License unknown. https://nvlpubs.nist.gov/nistpubs/SpecialPublications/1500-18/NIST.SP.1500-18r2.html (accessed 2026-10-30)

Worked demo

Read-through check: can you say three things?

No recitation needed. Tick each sentence below and see whether you can explain the mechanism, one worked example and one boundary in your own words.

Ticked 0 / 3

The numbers are teaching assumptions that show relationships, not forecasts or investment advice.

This article has passed the current publication gate. Factual, calculation and translation revisions update both language versions together.

Back to station