-
Notifications
You must be signed in to change notification settings - Fork 0
Stats proportioninterval
Development build. This page describes
main, not a released package. The latest published Lodestar.Stats is 0.4.0 — read its documentation.
Home › Stats › Hypothesis tests
Which interval a binomial proportion is reported with.
public enum ProportionInterval { Exact, Wilson, WilsonCorrected }Members — Exact is Clopper-Pearson, inverted from the binomial tails; scipy's 'exact', and
the default on both sides. Wilson is Wilson's score interval, scipy's 'wilson'.
WilsonCorrected is Wilson's with the half-unit continuity correction, scipy's 'wilsoncc'.
Example — the three on the same seven of twenty, widest last.
using Lodestar.Stats;
BinomialResult result = Binomial.Test(7, 20, 0.5);
double exact = Math.Round(result.ProportionConfidenceInterval().Low, 4);
double wilson = Math.Round(
result.ProportionConfidenceInterval(0.95, ProportionInterval.Wilson).Low, 4);
double clopperPearson = exact; // => 0.1539
double score = wilson; // => 0.1812Remarks — the three differ only where the question is hard, which is small samples. At a thousand trials they agree to three decimals and the choice does not matter. At twenty they disagree by two percentage points, and at five they disagree by more than the estimate is worth. Clopper-Pearson is conservative by construction — it inverts a discrete distribution, so its coverage is at least the level and usually above it. Wilson is calibrated on average and can dip below. The continuity correction pushes Wilson back toward Clopper-Pearson, buying coverage at the cost of width.
Applies to — net10.0, netstandard2.0.
See also —
BinomialResult.ProportionConfidenceInterval,
Binomial.Test, the Python equivalence table.