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/
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.
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.
Exercises
- A script overwrites
data/raw.csvon every run. What is wrong, and how should it be changed? - What should a README record so someone else can rerun the analysis?
- A rerun matches the paper's table but uses a different missing-data rule. Is that reproducible? How should it be reported?
Suggested answers
- 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. - Data source and access date, licence, version or hash, dependency versions, run command, expected outputs, runtime and known limitations.
- It is computationally repeatable but inconsistent with the documented method; record the rule, explain the difference, and recompute the paper's result.
Sources
- 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)
- 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.