Textbooks/Engineering Research and Experimental Methods/Chapter 2Lite (plain text) version
2Designing fair experiments
Version 1 · Technically checked (automated checks only) · 4 source lessons · 8 practice items
Introduction
A fair experiment changes one thing on purpose and makes sure nothing else changes with it. This chapter names the independent, dependent and controlled variables, decides how many runs are enough, and uses randomisation and balanced orders so drift and time of day cannot masquerade as an effect. Pilots catch broken procedures cheaply, negative controls catch broken measurements, and blinding keeps the experimenter's hopes out of the judgement.
Explanation
This chapter is built from 4 School lessons. Each part below is the lesson's own explanation; open the lesson for its predict-and-discover activities.
2.1 Change one thing
You switch the lift to PI control and also lighten the cabin. Error halves. Was it the controller?
Three kinds of variable
The independent variable is what you deliberately change (controller type). The dependent variable is what you measure (levelling error in mm). Controlled variables are everything else that could affect the result and is held fixed (load, trip, seeds). A control condition is the reference you compare against, often the current method.
Confounding
A confounder changes along with the independent variable and also affects the outcome. Changing controller and load together, or running all P trials in the morning and all PI trials after a firmware update, confounds the comparison. Fix it by holding the variable fixed or by varying it equally across conditions.
A testable hypothesis
'PI is better' is not testable. 'With a 450 kg load, PI reduces mean final levelling error compared with tuned P, over the same 10 seeds' names the change, the measure, the conditions and the comparison. It can clearly turn out false.
Common mix-ups
- Changing several things at once is efficient.
✓ It saves runs but makes the result uninterpretable unless the design deliberately crosses the factors.
2.2 How many runs is enough?
One run says the new filter halves the error. The next run says it makes things worse. How many runs before you believe either?
Mean ± SD, with n
Report repeated trials as mean ± standard deviation (n = …). The sample SD, √(Σ(x − x̄)²/(n − 1)), describes how much single runs vary. Always state n and whether the ± is SD or SE.
Standard error and sample size
The standard error SE = SD/√n describes how uncertain the mean is. To reach a target SE, you need n ≥ (SD/target)². Run a few pilot trials to estimate the SD, then choose n so the SE is small compared with the difference you care about.
Seeds and run order
In simulation, a seed fixes the random noise and disturbances, so a run can be repeated exactly and both methods can face identical conditions. On hardware, randomise the run order so drifts (battery, temperature, wear) spread across conditions instead of favouring one.
Common mix-ups
- More trials make the robot more consistent.
✓ More trials make your estimate of the mean more precise; the SD of single runs stays about the same.
2.3 Randomisation and confounding
You test gripper A all morning and gripper B all afternoon. B looks worse. Is it the gripper, or the tired battery?
Confounders
A confounder affects the outcome and changes along with the condition. Time of day, battery level, simulator warm-up, operator fatigue and the order of trials are classic ones. If a confounder is perfectly aligned with the condition, no statistics can separate them.
Breaking the link
Randomising the order makes the confounder independent of the condition on average. Counterbalancing (ABBA) cancels linear drift by design. Blocking groups trials by a known nuisance (e.g. per battery) and compares within blocks. All are better than 'all A then all B'.
Bias versus noise
Randomisation turns bias into noise: the confounder still adds variation, but it no longer pushes the estimate one way. More runs then shrink the noise. More runs of a confounded design only make you more confident in the wrong answer.
Common mix-ups
- Alternating ABAB is as good as randomising.
✓ Alternation handles slow drift but can align with any periodic nuisance; randomisation protects against confounders you have not thought of.
2.4 Pilots, controls and blinding
Your first ten runs reveal the metric is computed wrongly. Is that a disaster, or exactly what a pilot is for?
What pilots are for
A pilot checks that the procedure works: settings can be changed, the metric is computed correctly, failures are recorded, timing fits. It also gives an estimate of σ for the power calculation. Pilot data are not part of the confirmatory analysis, and pilot effect sizes should not be used to pick hypotheses.
Controls
A control condition shows what happens without the intervention. Positive controls (a case where the effect must appear) check the method can detect anything; negative controls (a case where no effect is possible) check it does not invent effects. A sham change, such as re-saving the same settings, is a useful negative control.
Blinding
Whenever a person judges an outcome (did it 'look stable'?), hide which condition produced it. In software, give runs coded names and unmask after scoring. Where blinding is impossible, use automatic metrics and say so as a limitation.
Common mix-ups
- If the pilot shows a big effect, you can skip the full study.
✓ Pilots are too small to estimate effects reliably and were not pre-registered; run the confirmatory study as planned.
Worked examples
Change one thing: example 1
Question: does a median filter reduce false obstacle stops? Name the variables.
Solution
Independent: filter on or off. Dependent: false stops per 100 m. Controlled: route, speed, sensor, lighting, seeds for simulated noise. Control condition: filter off.
How many runs is enough?: example 1
Five docking errors: 12, 15, 11, 14, 13 mm. Report them.
Solution
Mean = 65/5 = 13 mm. Deviations −1, 2, −2, 1, 0; squares sum 10; SD = √(10/4) ≈ 1.58 mm. Report 13.0 ± 1.6 mm (mean ± SD, n = 5). SE = 1.58/√5 ≈ 0.71 mm.
Randomisation and confounding: example 1
Drift lowers scores by 10 points over a 24-trial session. Blocked order, no true effect. Expected estimate?
Solution
A trials sit at positions 0–11 (average drop ≈ 2.4), B at 12–23 (≈ 7.6). Estimate ≈ −5.2: a false effect about half the total drift.
Pilots, controls and blinding: example 1
Design a negative control for a 'new filter reduces error' study.
Solution
Run the baseline twice under different labels (A and A′) through the whole pipeline. Any 'difference' between them shows how big a spurious effect your pipeline can produce.
Interactive figures
Interactive figure (online). Description: The experiment designer lists variables for two questions. For PI versus P in the lift: controller type is independent, levelling error is dependent, load, trip and seeds are controlled, door colour is irrelevant. For rover checkpoints: number of checkpoints is independent, final distance is dependent, route and camera trust are controlled.
Interactive figure (online). Description: The confounding simulator plots 24 trial scores in order; circles are condition A and squares condition B. A battery drift lowers later trials. Choosing the order (blocked, alternating, ABBA, randomised) changes the estimated effect; the readout gives the average bias over 300 repeated sessions.
Laboratory
Everything runs in your browser. No kit, nothing mains-powered. Simulations are simplified educational models.
Simulation OS experiment
Simulation OS: PID step response
Plan a fair comparison of two gain settings: fix the disturbance and noise, choose the run order and the number of seeded runs, then run it.
Open Simulation OS: PID step response →BUILD level
BUILD: Robotic gripper, level 5
Design a test of two gripper pad materials with a control condition and a way to judge grip success blind.
Open BUILD: Robotic gripper, level 5 →
Guided practice
Answers are checked on the server; wrong answers get a hint and another try. Signed in, solved items also count towards the source lesson.
- In 'Does checkpoint spacing change the rover's final error?', what is the dependent variable?
- Checkpoint spacing
- Final position error
- The route
- All baseline runs were done before lunch, all new-method runs after a battery swap. What is the problem?
- None
- Battery state is confounded with the method
- Too few runs
- Why run both controllers on the same list of seeds?
- It is faster
- So both face identical noise and disturbances, and differences come from the controllers
- Seeds make the results better
- Which number tells a user how much a single run of the robot will vary?
- Standard deviation
- Standard error
- Number of trials
- Why does ABBA ordering cancel linear drift?
- It randomises
- A and B have the same average position in time
- It uses fewer trials
- It hides the drift
- A confounded design is repeated with 10× more runs. What happens?
- Bias disappears
- The estimate becomes more precise around the wrong value
- It becomes randomised
- Power drops
- Which is a negative control?
- The new method on the hardest task
- Comparing the baseline with itself under different labels
- The best run
- A positive control
- How can you blind a manual judgement of simulated runs?
- Look harder
- Rename runs with random codes and unmask only after scoring
- Judge faster
- Ask the method's author
Engineering applications
Battery tests
Testing a new battery pack only on cool mornings and the old one in hot afternoons confounds chemistry with temperature. Interleaving and recording the temperature breaks the link.
Software comparisons
Running two controllers on the same list of random seeds pairs each run with its twin, so the difference reflects the controllers rather than luck in the disturbances.
Watch
Optional verified videos. Nothing loads from YouTube until you press play.
- Controlled Experiments: Crash Course Statistics #9 (CrashCourse)
- Correlation Doesn't Equal Causation: Crash Course Statistics #8 (CrashCourse)
Chapter summary
- Change one independent variable, measure the dependent variable, and hold or record everything else.
- Confounders change alongside the variable you care about; more runs do not fix a confounded design.
- Randomised or balanced orders such as ABBA protect against drift.
- Pilots test the procedure, negative controls test the measurement, blinding protects judgement.
Glossary
- Independent, dependent and controlled variables
- The independent variable is what you deliberately change, the dependent variable is what you measure, and controlled variables are everything you keep the same so the comparison is fair.
- Fair test and randomisation
- A fair test compares conditions so that the only systematic difference between them is the thing being studied; randomising the order of trials stops time-related effects favouring one condition.
- Confounding variable
- A confounding variable affects both the thing you changed and the thing you measured, creating an apparent link that is not a cause.
- Repeated trials
- Repeating a measurement or test several times shows how much results vary and lets you average out random error.
Definitions from the Field Guide.
Project: A test plan that could not fool you
Choose a comparison you can run in a School simulation. Write the variables, the control condition, the run order (randomised or balanced), the number of runs with a reason, a pilot and one negative control. Run the pilot and revise the plan.
Deliverables
- The written plan with every variable named
- Pilot results labelled as simulated
- The revised plan and what the pilot changed
Keep your work in your Engineering Journal; it stays private unless you choose to share it.
References
- Douglas C. Montgomery (2017). Design and Analysis of Experiments, 9th edition. Wiley.
- George E. P. Box et al. (2005). Statistics for Experimenters: Design, Innovation, and Discovery, 2nd edition. Wiley.
Publication record
- Version
- 1
- Status
- Technically checked (automated checks only)
- Technical review
- Automated checks only, last run 2026-11-29. No human, educator or mentor review is claimed.src/content/textbooks/textbooks.test.ts: schema, every lesson, diagram, practice item, video, Field Guide entry, lab and reference resolves; figure numbers recomputed; no practice answers in client payloads.
- Written by
- Compiled and written by the Tactiverge team with AI assistance, from Tactiverge School lessons that were themselves written with AI assistance.
- Licence
- All rights reserved by the founders unless a licence is approved.
- Corrections
- None recorded yet.Spotted a mistake? Use “Report a problem” on any chapter, or see the corrections page.