School/✦ Research Engineer/Week 31
Reproducible by design: seeds, versions, data
Six months from now, can you regenerate Figure 3 exactly? Can a stranger? What would they need?
About 40 min · 3 goals · Checked by automated tests
1.Why should I care?
Reproducibility is not paperwork; it is how you debug your own research. When a number looks wrong, the ability to regenerate it from a recorded seed and commit is the difference between a five-minute fix and starting again.
- ◇ Record seeds, code versions and dependencies so every result can be regenerated.
- ◇ Keep raw data separate and script every processing step.
- ◇ Use a reporting checklist to find gaps before a reviewer does.
2.Discover
Start from 'Typical first draft'. Read what a reviewer could not do. Tick items one at a time and watch the list shrink. Which three items, if missing, would stop anyone regenerating your figures at all?
Loading the interactive…
Can't use the interactive? Read a description instead
The reproducibility checklist scorer lists twelve items in five groups (code, randomness, data, reporting, credit), each with a weight. Ticking items raises a score bar; the readout lists what a reviewer could not do because of the missing items.
3.Checkpoint: guided practice
Check what you just discovered before going on. Hints appear after a wrong answer.
Practice 1 · a fresh version every time
A simulation draws pseudo-random numbers with x(next) = (5·x + 7) mod 64, seeded with x0 = 62. A reviewer re-runs it with the same seed. What is x4, the value after 4 steps?
4.Apply it
Set up your capstone repository now: raw/ and processed/ folders, a pinned environment, a seed log, and a single script that will regenerate the figures. Score it with the checklist and fix the top three gaps.
5.Understand
Determinism
A pseudo-random generator produces the same sequence from the same seed. Record the seed for every run, and report results across several seeds so a lucky seed cannot carry the result. Record the commit of your code and pin library versions, because the same seed in a different version can give a different sequence.
Raw data are sacred
Keep raw outputs unedited and separate from processed data. Every exclusion, filter and transformation is done by a script with the reason in a comment. Then anyone can check that processing did not create the result.
One command
The gold standard: one documented command regenerates every figure and table from raw data. Reporting checklists (many venues publish one) ask exactly these questions; scoring yourself before submission finds gaps early.
Explain it another way
A recipe that says 'some flour, bake until done' cannot be repeated. Seeds and versions are the exact quantities and oven temperature.
Reproducible (same data and code give the same result) is weaker than replicable (new data, same method, consistent result). Both matter; the first is fully in your control.
An LCG x_{k+1} = (a·x_k + c) mod m is fully determined by (a, c, m, x₀): record those and anyone can regenerate the stream.
Build levels on this site recompute recorded runs on the server from their settings: the same idea, applied to marking.
Worked example 1
x_{k+1} = (5x + 3) mod 16, seed 7. First three values?
x₁ = (35 + 3) mod 16 = 38 mod 16 = 6. x₂ = (30 + 3) mod 16 = 1. x₃ = (5 + 3) mod 16 = 8. Anyone with the seed and the rule gets 6, 1, 8.
Common mix-ups
- My results are reproducible because I could rerun them on my laptop.
✓ Reproducible means a stranger with your repository, data and instructions can regenerate them, on their machine.
6.Practice on your own
Practice, not a test. Wrong answers get a hint and another try.
Practice 2
Why report results across several seeds?
Practice 3
Where should an exclusion of three crashed runs be done?
Practice 4
Another team reruns your method on new seeds and new routes and gets consistent results. This is…
Practice 5 · a fresh version every time
A simulation draws pseudo-random numbers with x(next) = (9·x + 1) mod 100, seeded with x0 = 63. A reviewer re-runs it with the same seed. What is x3, the value after 3 steps?
7.Predict
Two people run the same simulation script and get different results. Most likely cause?
Guess first. Being wrong here is how the surprise works.
8.Reflect
Concepts: Reproducibility and documentation · Honest reporting and research integrity · Probability and Monte Carlo simulation