Hybrid· R✓ Code checkedAccessibility checks passPublished

One Trial, Many Trials

By Alexis Diamond · Statistics · causal inference · Undergraduate · Simulation of a known property · version 5

Students run a simulated tutoring experiment again and again, and see that any single RCT estimate misses the true effect while the average of many lands on it. They also see the spread of estimates shrink with the square root of n. Interactive dials drive R code cells, and students then complete the key calculations themselves.

Report this artifact

Reports are anonymous. The artifact stays up until we've checked it.

Licence: CC BY 4.0

Assumption ledger

  • parameterPopulation of N = 2000 students. Score without tutoring Y(0) ~ Normal(50, 10). Individual effect tau ~ Normal(5, 4), independent of Y(0). Y(1) = Y(0) + tau. The true ATE is the mean of tau in this population, about 5 points.
  • distributionEach trial draws n students independently with replacement from the population. Exactly n/2 are assigned to treatment, by a random shuffle. The estimator is mean(treated outcomes) minus mean(control outcomes).
  • distributionVar(estimate) = v1/(n/2) + v0/(n/2), where v1 and v0 are the population variances of Y(1) and Y(0). This is exact for this sampling scheme. SD = sqrt of that, which is proportional to 1/sqrt(n).
  • simplificationNo dropout, no spillovers between students, full compliance, one outcome, and a single fixed population whose potential outcomes are all known (which is possible only in a simulation).
  • simplificationThe break-it control makes treatment depend on baseline score: students are ranked by a noisy score of selection x (Y(0) - 50)/10 plus standard normal noise, and the top half are treated. At 0 this is pure randomization.
  • dataNo external data. Every number is simulated in the R setup cell with set.seed(2024). Each trial set uses the seed on the page.
  • interpretationUnbiased is read as: the mean of the estimator over repeated trials equals the ATE. It is not a claim about any one trial.
  • interpretationThe model answer to the exit question uses the setup population's theoretical SD: about 3.3 points at n = 40 and 1.6 at n = 160. A miss of 4 points is about 1.2 SDs at n = 40 (common) and about 2.4 SDs at n = 160 (rare). Real schools do not know the true effect, so the answer also says the school should report a plausible range rather than one number.
  • interpretationShared state: every button writes only to a state key (New seed to seed, Check my predictions to reveal, Compare with a model answer to exit_reveal, Lock/Unlock to locked). Both predictions and the written exit answer are listed as responses. The instructor's lock message is derived from locked; only the typed instructor code and a transient 'Code not recognised' notice stay local, because the code is a credential.
  • interpretationInstructor lock: typing the code RCT (any case) in the corner Instructor box and pressing the button toggles the boolean `locked` in state. While it is true, the sliders, radio choices, display-size selector, buttons and written-answer box ignore student input. The code is visible in the page source, so this is a soft lock for classroom use, not security. Code-cell editors are platform-owned, so setting them read-only is best-effort.
  • interpretationStyle: Chronicle Display is not on Google Fonts, so EB Garamond is used for headings. Neue Haas Grotesk is replaced by Helvetica Neue, Helvetica and Arial. Clay is used only for text, buttons and lines on White, Ivory and Bone, and Bone replaces it on dark backgrounds. Goldenrod appears only as the dashed truth line in dark mode. The instructor box uses Charcoal with white text and a Clay button with a white border.

Breakout check

Not checked yet.

Code checks

✓ Code checked: the reference solutions pass every exercise's checks.

Built-in checks 10 of 10 pass

  • histogram keeps every finite estimate (passes)
  • estimates beyond the axis land in the end bins (passes)
  • non-finite values are ignored (passes)
  • n slider allows only even sizes of at least 10 (passes)
  • missing values display as an en dash (passes)
  • quadrupling n halves the theoretical SD (passes)
  • instructor code RCT is accepted in any case with spaces trimmed (passes)
  • wrong or empty instructor codes are rejected (passes)
  • every control key and response key exists in state (passes)
  • new seed wraps from 99 to 1 and stays in range (passes)

Cite this

Alexis Diamond (2026). One Trial, Many Trials [Interactive model], version 5. Ideas at Play. https://ideasatplay.org/play/one-trial-many-trials-5267f0?v=5 (CC BY 4.0)

History

  1. v5Every button now acts only through a state key, the instructor lock message is derived from shared state, and both predictions are listed with the exit answer as collected responses; state keys are unchanged. (generated, Oct 20, 2026)current
  2. v4Added an instructor lock: type RCT in the small Instructor box in the bottom corner and press the button to freeze the student controls (the lock is a new `locked` state key, so it syncs in sessions), and repeat to unlock. The code editors are read-only only on a best-effort basis, and the code is visible in the page source, so the lock is not secure. (generated, Oct 20, 2026)View
  3. v3Answer to your question: a good answer says the trial did not fail (randomization guarantees being right on average across trials, not in any one trial). A 4-point miss is about 1.2 SDs of the trial-to-trial spread at n = 40 (SD about 3.3), so it is common. The school should treat +9 as one noisy draw and report a range (roughly +2 to +16) rather than a point. With 160 students the SD halves to about 1.6, so estimates cluster tighter and a 4-point miss would be rare. I added this as a model answer under the exit question, unlocked by a button once the student has typed their own answer. No existing state keys changed; exit_reveal is new. (generated, Oct 20, 2026)View
  4. v2Fixed the definition-list accessibility error by moving the 'off by' notes inside their dd elements (readout values now sit in spans); nothing else changed. (generated, Oct 20, 2026)View
  5. v1First version: a Hybrid R artifact in the Minerva style with a prediction anchor, a break-it selection control, three scaffolded exercises, and a written exit question. (generated, Oct 20, 2026)View

Comments

No comments yet.

Sign in to comment or like.