Lite / Textbooks / Engineering Research and Experimental Methods / Chapter 6
6. Power, pre-registration and reproducibility
Introduction
Three habits separate studies that can be trusted from studies that just happened to work. Plan the sample size so a real effect would probably be detected. Write the plan down, with a timestamp, before the data exist. And make every result reproducible: seeds, software versions, raw data and every exclusion recorded. This chapter treats all three as engineering, and adds the hardest one: keeping honest records when the result disappoints.
Figure 6.1. How many runs is enough? (described in words)
Approximate power to detect an effect of d = 0.5 with a two-sample test at α = 0.05, by runs per group: 0.2 at n = 10, 0.35 at n = 20, 0.61 at n = 40, 0.81 at n = 64 and 0.94 at n = 100. About 63 runs per group are needed for power 0.8.
Explanation
Built from 4 School lessons. Each part is the lesson's own explanation.
6.1 How many runs? Power and sample size
Ten runs felt like plenty. Then a reviewer asks: what was your chance of detecting the effect if it was real?
Power
Power is the probability that your study detects an effect of a given size if it is really there. It rises with the true effect d, the number of runs n and a looser α. 80% is a common target, meaning a 20% chance of missing a real effect of size d.
Where σ and d come from
σ comes from a pilot or previous work. d should be the smallest effect you care about, not the effect you hope for: planning for a large hoped-for effect produces an under-powered study for the effect that matters.
The winner's curse
If power is low, only the studies that happened to overestimate the effect reach significance. So an under-powered study that 'succeeds' usually exaggerates. This is one reason small published studies often shrink on replication.
Derivation: Runs needed for a target margin
For a mean of n runs with SD σ, SE = σ/√n.
The 95% margin of error is E = 1.96 · σ/√n.
Solve for n: √n = 1.96σ/E, so n = (1.96σ/E)².
For a difference of two independent means with n each and the same σ: SE_diff = σ√(2/n).
For 80% power at two-sided α = 0.05 the expected statistic must sit 1.96 + 0.84 standard errors from zero: d·√(n/2) = 2.80.
So n per group = 2 · (2.80/d)² where d = δ/σ. Halving d quadruples n.
Common mix-ups
A non-significant result from a small study shows there is no effect.
✓ With low power, a real effect is often missed. Report the interval and the power for the effect that matters.
Open the Lite lesson: How many runs? Power and sample size
6.2 Pre-registration: write the plan before the data
If you decide how to analyse your data after seeing it, how would you know you had not just found the analysis that agreed with you?
What to record
Question and hypothesis with direction and SESOI; design (conditions, randomisation, seeds); primary metric and how it is computed; sample size and how it was chosen; exclusion rules; the analysis (test, interval, decision rule); and the date. Store it somewhere time-stamped (a public registry, or a committed file in version control).
Confirmatory versus exploratory
Tests in the pre-registration are confirmatory: their error rates mean what they say. Anything else is exploratory: interesting, worth reporting, but a lead for future work, not a finding. Label them separately in the report.
Deviations happen
A simulator crashes, a metric turns out to be ill-defined. Deviating is allowed; hiding it is not. List each deviation, why it happened and whether it was decided before or after seeing outcome data.
Common mix-ups
Pre-registration stops you exploring your data.
✓ It labels exploration as exploratory. You can still look at everything; you just cannot present a discovery as a prediction.
Open the Lite lesson: Pre-registration: write the plan before the data
6.3 Reproducible by design: seeds, versions, data
Six months from now, can you regenerate Figure 3 exactly? Can a stranger? What would they need?
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.
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.
Open the Lite lesson: Reproducible by design: seeds, versions, data
6.4 Honest records: notebooks, fabrication and falsification
One run crashed and one looks 'obviously wrong'. Deleting them would make the graph cleaner. What is the line between cleaning and falsifying?
The research notebook
Dated entries, written at the time: what you planned, what you did, what happened, what went wrong and what you decided. Never rewrite history: add corrections as new entries. In code, an append-only log with seeds and settings is your notebook.
Fabrication and falsification
Fabrication is making up data or results. Falsification is manipulating materials, equipment, processes, data or images, or omitting data, so the record misrepresents the work. Together with plagiarism they are the core forms of research misconduct.
Anomalies
Decide exclusion rules before data (e.g. 'runs where the simulator reports a numerical error'). Apply them by script. Report how many runs were excluded and why, and show results with and without exclusions when it matters. A run that merely disagrees with you is data.
Common mix-ups
Removing obviously wrong data points is just good cleaning.
✓ Cleaning follows rules fixed in advance and is fully reported. Removing points because they look wrong to you is selective reporting.
Open the Lite lesson: Honest records: notebooks, fabrication and falsification
Worked examples
How many runs? Power and sample size: example 1
Pilot SD 0.3 s; you want a 95% margin of 0.1 s on a mean. Runs?
Solution
n = (1.96 × 0.3 / 0.1)² = 5.88² = 34.6, so 35 runs. For a margin of 0.05 s: 138 runs.
Pre-registration: write the plan before the data: example 1
Halfway through, you realise settling time should use a 2% band, not 5%. What now?
Solution
Decide before looking at outcome data if possible. Record the change, its date and reason as a deviation. Report both definitions, label the pre-registered one as primary unless the change was made blind to outcomes, and let readers judge.
Reproducible by design: seeds, versions, data: example 1
x_{k+1} = (5x + 3) mod 16, seed 7. First three values?
Solution
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.
Honest records: notebooks, fabrication and falsification: example 1
Two of 20 runs give errors five times larger than the rest. No rule was pre-stated. What do you do?
Solution
Keep them. Investigate the logs: if a recorded fault explains them, report that, show results with and without, and propose the rule for future studies. Do not silently delete them.
Interactive figures, in words
Figure 6.2 from How many runs? Power and sample size
Set d = 0.5 and slide n until power reaches 80%. Then halve d: how many runs now? Switch α to 0.005 and watch the critical line move. Finally set n = 10 and read the smallest effect you could reliably detect.
The power explorer draws two bell curves: the test statistic with no effect, and with the true effect. A red critical line marks significance; the shaded area of the second curve beyond it is the power. Sliders set effect size, runs per group and α; the readout gives power and the runs needed for 80% and 90%.
Figure 6.3 from Reproducible by design: seeds, versions, data
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?
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.
Laboratory
These run in a browser on the full site (they need a faster connection). Simulations are simplified educational models.
- Equation Lab: Distributions (Equation Lab exploration)
Simulate many small studies of a real but modest effect and count how often each one detects it.
Open on the full site - BUILD: Smart greenhouse, level 5 (BUILD level)
Write a pre-registration for a greenhouse controller comparison, including the seeds, runs per condition and exclusion rules.
Open on the full site
Practice
Each question links to its Lite lesson, where your answer is checked on our server and a wrong answer gets a hint. Answers are never sent to your device.
- Power 0.8 means…
Answer it in “How many runs? Power and sample size” - Which d should you plan for?
Answer it in “How many runs? Power and sample size” - A design needs 20 runs per group for d = 0.9. About how many for d = 0.45?
Answer it in “How many runs? Power and sample size” - You notice an unexpected pattern not in your plan. How do you report it?
Answer it in “Pre-registration: write the plan before the data” - Your simulator version changed mid-study. What is the honest response?
Answer it in “Pre-registration: write the plan before the data” - Another team reruns your method on new seeds and new routes and gets consistent results. This is…
Answer it in “Reproducible by design: seeds, versions, data” - A learner runs out of time and writes in five plausible results for runs never done. This is…
Answer it in “Honest records: notebooks, fabrication and falsification” - Your hypothesis was refuted. What is the right thing to report?
Answer it in “Honest records: notebooks, fabrication and falsification”
Engineering applications
Avoiding wasted studies
A comparison with eight runs per condition has little chance of detecting a moderate effect. Calculating power first shows whether the study is worth running at that size at all.
Reproducible simulations
A simulation study that records its seeds, model version and parameter files can be rerun by a reviewer in minutes, which turns 'trust me' into 'check me'.
Watch (optional)
Streaming video uses a lot of data. Everything you need is in the text.
- “Statistical Power, Clearly Explained!!!” by StatQuest with Josh Starmer
- “Registration & Preregistration” by Center for Open Science
- “Is there a reproducibility crisis in science? - Matt Anticole” by TED-Ed
- “You Should Be Keeping a Research Notebook” by JoshTheEngineer
Summary
- Power is the chance a study detects an effect of a stated size; plan for 0.8 or more.
- Required runs grow as 1/d²: halving the effect size quadruples the sample.
- Pre-register hypotheses, measures, sample size, exclusions and analysis before the data exist.
- Reproducible means the same inputs give the same results; record seeds, versions, raw data and exclusions.
- Never fabricate or omit data; report refuted hypotheses and deviations openly.
Glossary
- Engineering lab notebook
- A lab notebook is a dated, chronological record of what you planned, did, observed and decided, written at the time rather than afterwards. Field Guide
- Repeated trials
- Repeating a measurement or test several times shows how much results vary and lets you average out random error. Field Guide
- Outliers and honest data
- An outlier is a reading far from the rest. It may be a genuine effect or a fault; either way it must be investigated and reported, and any exclusion rule decided before seeing the results. Field Guide
- Hypothesis
- A hypothesis is a specific, testable statement about how one variable affects another, written so that a measurement could show it to be wrong. Field Guide
Project: Pre-register a simulated study
Write a dated pre-registration for a comparison in a School simulation: hypothesis, outcome, smallest effect, power calculation, seeds, exclusion rules and analysis. Run it exactly as written and report any deviation in a separate section.
Deliverables
- The dated pre-registration
- The power calculation
- Results with a deviations section, labelled as simulated
Write it up on paper or in your own notes. Lite never stores what you write.
References
- Jacob Cohen (1988). Statistical Power Analysis for the Behavioral Sciences, 2nd edition. Lawrence Erlbaum Associates.
- Brian A. Nosek et al. (2018). "The Preregistration Revolution". Proceedings of the National Academy of Sciences 115(11), 2600–2606.
- John P. A. Ioannidis (2005). "Why Most Published Research Findings Are False". PLoS Medicine 2(8).