Lite / Textbooks / Engineering Research and Experimental Methods / Chapter 2
2. Designing fair experiments
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.
Figure 2.1. Order can fake an effect (described in words)
Four runs of conditions A and B while results drift by −2 per slot. In the order AABB, A sees a mean drift of −1 and B of −5, a false difference of 4 with no real effect. In the order ABBA both see −3, so the bias is 0.
Explanation
Built from 4 School lessons. Each part is the lesson's own explanation.
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.
Open the Lite lesson: Change one thing
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.
Open the Lite lesson: How many runs is enough?
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.
Open the Lite lesson: Randomisation and confounding
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.
Open the Lite lesson: Pilots, controls and blinding
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, in words
Figure 2.2 from Change one thing
Pick a question, classify every variable, and choose trials and run order. Before checking, write one sentence: 'If I forgot to control ___, the result could be wrong because ___.'
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.
Figure 2.3 from Randomisation and confounding
Set the true effect to 0 and drift to 10. Compare the bias over 300 repeats for each trial order. Then set drift to 0: does the order still matter? Finally set a true effect of 2 with drift 10: which schedule recovers it?
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
These run in a browser on the full site (they need a faster connection). Simulations are simplified educational models.
- Simulation OS: PID step response (Simulation OS experiment)
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 on the full site - BUILD: Robotic gripper, level 5 (BUILD level)
Design a test of two gripper pad materials with a control condition and a way to judge grip success blind.
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.
- In 'Does checkpoint spacing change the rover's final error?', what is the dependent variable?
Answer it in “Change one thing” - All baseline runs were done before lunch, all new-method runs after a battery swap. What is the problem?
Answer it in “Change one thing” - Why run both controllers on the same list of seeds?
Answer it in “How many runs is enough?” - Which number tells a user how much a single run of the robot will vary?
Answer it in “How many runs is enough?” - Why does ABBA ordering cancel linear drift?
Answer it in “Randomisation and confounding” - A confounded design is repeated with 10× more runs. What happens?
Answer it in “Randomisation and confounding” - Which is a negative control?
Answer it in “Pilots, controls and blinding” - How can you blind a manual judgement of simulated runs?
Answer it in “Pilots, controls and blinding”
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)
Streaming video uses a lot of data. Everything you need is in the text.
- “Controlled Experiments: Crash Course Statistics #9” by CrashCourse
- “Correlation Doesn't Equal Causation: Crash Course Statistics #8” by CrashCourse
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. Field Guide
- 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. Field Guide
- 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. 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
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
Write it up on paper or in your own notes. Lite never stores what you write.
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.