TactivergeLite

Lite / Textbooks / Engineering Research and Experimental Methods / Chapter 6

6. Power, pre-registration and reproducibility

Version 1 · Technically checked (automated checks only) · 4 source lessons · Full interactive version

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
  1. For a mean of n runs with SD σ, SE = σ/√n.

  2. The 95% margin of error is E = 1.96 · σ/√n.

  3. Solve for n: √n = 1.96σ/E, so n = (1.96σ/E)².

  4. For a difference of two independent means with n each and the same σ: SE_diff = σ√(2/n).

  5. 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.

  6. So n per group = 2 · (2.80/d)² where d = δ/σ. Halving d quadruples n.

Common mix-ups

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

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

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

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.

The interactive versions are in the full chapter.

Laboratory

These run in a browser on the full site (they need a faster connection). Simulations are simplified educational models.

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.

  1. Power 0.8 means…
    Answer it in “How many runs? Power and sample size”
  2. Which d should you plan for?
    Answer it in “How many runs? Power and sample size”
  3. 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”
  4. 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”
  5. Your simulator version changed mid-study. What is the honest response?
    Answer it in “Pre-registration: write the plan before the data”
  6. 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”
  7. 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”
  8. 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.

Summary

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

Write it up on paper or in your own notes. Lite never stores what you write.

References

← 5. Reading the literature7. Inference done right →