Compatibility curves and S-values
A p-value tests one value and an interval reports one level. Read every value at once with a compatibility curve, and turn p into bits of surprise with the S-value.
What runs in CodeSplash
- Two-sample t-test (Welch / Student, or z test) Verified in Python and R
You will be able to
- Read a confidence interval as the values compatible with the data
- Convert a p-value into an S-value and explain it in coin flips
- Draw a compatibility curve for a simple estimate
Read first
Zero isn't special
PredictAn ordinary p-value tests one value, usually zero. Nothing stops you from testing another.
Predict first
ToothGrowth's difference in means is 3.70, with a standard error of 1.93. Which hypothesized difference fits these data better: 0 or 7?
Reveal
About equally, and 7 fits slightly better. Testing 0 gives p = .061. Testing 7 gives and . You probably wouldn't call a difference of 7 "shown". The data have no more quarrel with it than with no difference at all.
Intervals are lists of unsurprising values
ReadA confidence intervalConfidence intervalA range of effect values compatible with your data at the chosen confidence level. is the set of values a test wouldn't reject at that level. So you can read a 95% interval as: "these are the differences these data are reasonably compatible with, given the model".
For ToothGrowth that list runs from −0.17 to 7.57. A value barely outside isn't refuted, and a value barely inside isn't proved. Compatibility fades gradually as you move away from the estimate.
Draw all the intervals at once
ReadPlot the p-value for every hypothesized difference and you get a compatibility curveCompatibility curveThe p-value for every hypothesized effect size, drawn as a curve that peaks at the estimate.. It peaks at the estimate, and each horizontal slice is one interval: gives the 95% interval, and gives the 90% interval.
CodeSplash reports one level at a time, set by the Confidence level option. This script draws the whole curve.
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
est, se, df = 3.7, 1.93184, 55.3094
values = np.linspace(-3, 11, 400)
p = 2 * stats.t.sf(np.abs((est - values) / se), df)
plt.plot(values, p)
plt.axhline(0.05, ls=":")
plt.xlabel("Hypothesized difference")
plt.ylabel("p-value")
plt.show()est <- 3.7; se <- 1.93184; df <- 55.3094
values <- seq(-3, 11, length.out = 400)
p <- 2 * pt(abs((est - values) / se), df, lower.tail = FALSE)
plot(values, p, type = "l",
xlab = "Hypothesized difference", ylab = "p-value")
abline(h = 0.05, lty = 3)See an area become a p-value
ExploreThe curve's height at each value is an area like this one. Move the observed statistic and read the p-value that a test of that value would give.
BExplorable · The p-value as an area
What exactly is a p-value a probability of?
Picture the reference curve and where the statistic falls. Will p land below α?
Reference distribution
Used by the t and χ² references.
Alternative
If H₀ were true, a statistic at least as extreme as 1.70 would turn up 8.9% of the time: p = .089.
Commit your prediction above to see the result
Make your prediction to see the result.
Bits of surprise
ReadThe S-valueS-valueA p-value on a scale of coin flips, s = −log₂(p), as surprising as s heads in a row. rescales p into something you can picture:
It reads as coin flips: heads in a row from a coin you were told is fair. For ToothGrowth, testing zero gives , about as surprising as four heads in a row. Worth noticing, and not a reason to accuse the coin.
Unlike p, S-values add up: independent evidence accumulates, and doubling the bits squares the p-value.
Check your understanding
CheckpointCheck yourself
What is the S-value of ? Give two decimals.
Show the answer
Answer: 4.32
: a bit more than four heads in a row. The conventional threshold is less surprising than it sounds.
Check yourself
A compatibility curve crosses at 2 and 9. What is that?
Show the answer
Answer: b
The slice at is the interval. It is a statement about the procedure and the data, not a probability about this one interval.
Check yourself
A result has p = .03 against zero, and the estimate is 2 with a 95% interval from 0.2 to 3.8. What is the best description?
Show the answer
Answer: c
Read the range. Nothing here has been proved or ruled out, and values near the edges are only slightly less compatible.
Try another level
In the appRun a t test twice with different values of the Confidence level option and watch the interval change while the estimate stays still. Those two intervals are two slices of the curve above.
Recap
Recap- An interval is a list of values compatible with the data, and compatibility fades gradually at its edges.
- A compatibility curve shows every interval at once.
- turns a p-value into a number of fair coin flips.
Concepts in this lesson