Bayesian Analysis of a Small Experiment

Python · PyMC · ArviZ  ·  Darwin’s Zea mays, 15 matched pairs

A Result Four Thousandths of an Inch From the Boundary

The frequentist treatment of Darwin's maize settled it three ways, and read like for like the three do not quite agree. Fisher's exact permutation test over all 2152^{15} sign patterns gives a two-sided pp of 0.0527; the paired tt-test gives 0.0497; Neyman's interval is [0.004, 5.229]. On the conventional threshold the assumption-free test fails and the normal-theory one passes, separated by three thousandths. The interval is the reason for this page. The interval clears zero by four thousandths of an inch, and a result that marginal invites a question the frequentist machinery has no way to answer: how much of this conclusion is Darwin's plants, and how much is the analysis? There is no dial to turn. A Bayesian treatment has exactly that dial.

diN(τ, σ2),τN(0, s2),σHalf-Normal(10)d_i \sim \mathcal{N}(\tau,\ \sigma^2), \qquad \tau \sim \mathcal{N}(0,\ s^2), \qquad \sigma \sim \text{Half-Normal}(10)

The model is deliberately plain, so nothing turns on cleverness: the 15 within-pair differences are normal around an effect τ\tau, with a prior on τ\tau centred at zero and a scale ss that controls how firmly it insists. Centring at zero matters for how the output should be read — the prior is not helping the conclusion along, it is pulling against it.

The first result is that the verdict changes. With s=10s = 10 — a prior standard deviation four times the observed effect, which nobody would describe as informative — the 95% credible interval (the range holding 95% of the posterior probability, which is what most people wrongly assume a confidence interval is) runs [−0.050, 5.256] and contains zero, where the tt-interval excluded it. Pr(τ>0)=0.9721\Pr(\tau>0) = 0.9721, just under the 0.975 a one-sided test at 0.025 would require. Nothing about the plants changed between those two lines.

That is not a Bayesian conjuring trick, and it should not be read as one framework catching the other out. It is what a result sitting four thousandths of an inch from a threshold was always going to do on contact with a second method. The useful lesson is about the fragility of the original finding, not about the superiority of either approach.

How Much of the Verdict Is the Prior?

The sensitivity sweep is the deliverable the published page could not produce: refit across prior scales from 0.5 (a sceptic who thinks the effect is almost certainly under half an inch) to 100 (essentially flat), and watch what the data can and cannot defend.

prior sd on τposterior mean95% credible intervalPr(τ > 0)
0.5 strongly sceptical0.312[−0.648, 1.251]0.745
10.956[−0.726, 2.543]0.876
21.821[−0.413, 3.965]0.946
32.206[−0.282, 4.582]0.959
52.457[−0.032, 5.068]0.973
102.621[0.046, 5.335]0.976
100 essentially flat2.599[0.066, 5.235]0.977

Two different things happen to the two different claims. The direction is robust to ignorance but not to active scepticism: Pr(τ>0)\Pr(\tau>0) holds above 0.94 for any prior scale of 2 or more — that is, any prior that does not rule out an effect the size of the one observed — and then falls to 0.876 at s=1s=1 and 0.745 at s=0.5s=0.5. The magnitude is fragile throughout: the point estimate runs from 0.31 to 2.62 inches across the same sweep. Fifteen pots can say the effect is probably positive. They cannot say how large it is, and no amount of analysis will change that.

The Outliers, and the Assumption Fisher Refused to Make

The last section addresses the assumption Fisher was avoiding in the first place. Darwin's differences contain two large negatives, −8.375 and −6.000, against thirteen positives. The paired tt-test must treat those as ordinary draws from the same normal, which inflates the estimated spread and widens its interval; Fisher's permutation test sidesteps the issue by assuming nothing about shape at all. A third route keeps the parametric structure but lets the tails be heavy, replacing the normal likelihood with a Student-tt whose degrees of freedom are estimated rather than assumed.

The degrees-of-freedom parameter ν\nu is the dial: small values mean heavy tails, and above roughly 30 a Student-tt is indistinguishable from a normal. Its posterior median here is 15.2, with Pr(ν<10)=0.31\Pr(\nu < 10) = 0.31 — mild but real tail-heaviness, exactly what two outliers in fifteen observations should produce. And the effect of taking it seriously runs against the intuition that robustness costs confidence: down-weighting the two negative pairs removes variance the tt-test had to carry, so the estimate rises to 2.855 and the interval tightens to [0.183, 5.374], excluding zero more comfortably than the tt-test did.

Which leaves three analyses of one fifteen-pot experiment disagreeing about whether the effect is established:

same 15 pairs, three analyseseffect95% intervalPr(τ > 0)excludes zero?
paired t-test2.617[0.004, 5.229]0.9751yes — by 0.004 in
Bayes, normal likelihood (prior sd 10)2.573[−0.050, 5.256]0.9721no
Bayes, Student-t likelihood2.855[0.183, 5.374]0.9806yes — comfortably

Reading those three lines together is the point of the page. The disagreement is not a defect in any of them — each is correct given its assumptions, and the assumptions are all defensible. It is a property of the evidence. A knife-edge result carries less information than its p-value suggests, and the only way to see that is to analyse it more than once.

Where this sits

The prior-sensitivity discipline recurs throughout the Bayesian arc, and the Student-tt likelihood is the same robustness device used in the heavy-tails distribution notebooks. What this page does not do is more interesting than what it does: it changes nothing about identification. Randomization already settled that, and every model here inherits it unexamined. The next example in this group moves from one effect with a sceptical prior to four effects shrinking toward each other, where the Bayesian machinery starts doing structural work rather than sensitivity analysis.

Notebook

References