Article — P-Hat Sample Proportion Calculator
P-hat sample proportion calculator
P-hat (p̂) is the sample proportion: successes divided by sample size. For x = 520 yes-votes in a poll of n = 1000, p̂ = 0.520 = 52.0%. It is the best point estimate of the unknown population proportion p, and it comes with a standard error of √(p̂(1−p̂)/n) — which sets the width of the confidence interval around it.
The math is simple. The interpretation is not. P-hat estimates p but is not equal to p; the confidence interval describes how far apart they probably are. This calculator computes p̂, the standard error, the margin of error, and the confidence interval in one pass, with a normality check for the underlying normal approximation.
What is p-hat?
P-hat is the fraction of sample observations that fall into a category of interest. In a survey of 200 people, if 80 are vegetarian, the p-hat for vegetarians is 80/200 = 0.40. It is bounded between 0 and 1, and it is the simplest point estimate of the corresponding population proportion.
The hat in p̂ is the statistical convention for an estimator — a quantity computed from data that approximates an unknown parameter. The Greek p (no hat) denotes the true population proportion. The two are different objects: p is fixed but unknown; p̂ is observed but varies with the sample.
The hat notation for sample estimates dates to early-1900s English statistics. R.A. Fisher used a tilde (p̃) in his 1925 textbook, but the hat (p̂) spread faster because it was easier to typeset on mechanical typewriters with a hat symbol available in standard sets.
The p-hat formula
Every quantity you need for a confidence interval on a proportion follows from three numbers: x (successes), n (sample size), and the chosen confidence level.
p̂ = x ÷ n SE = √(p̂q̂ / n) where q̂ = 1 − p̂ME = z · SE CI = p̂ ± MEz₉₅ = 1.96 z₉₉ = 2.576 Wald valid if n·p̂ ≥ 5 and n·q̂ ≥ 5Plug your sample numbers in and out come the four quantities. For x = 32, n = 200 (a 16% conversion rate from a 200-visitor A/B test): p̂ = 0.16, q̂ = 0.84, SE = √(0.16 × 0.84 / 200) = 0.0259. For 95% CI, z = 1.96, ME = 0.0508 = 5.08 percentage points. CI = [10.9%, 21.1%].
P-hat versus population proportion p
This is the single most common point of confusion. The population proportion p is what you actually want to know — the true fraction of voters, customers, or defective parts in the population. P-hat is what you can compute from a finite sample. They are different in general, and their difference is exactly what the confidence interval bounds.
A census of the entire population would give p̂ = p exactly. With a sample, p̂ has error that shrinks as n grows. Poll 10 voters and your p̂ might be 0.4; poll 1000 and you'll be close to 0.5; poll 10 million and p̂ essentially equals p.
P-hat standard error and confidence interval
The standard error of p-hat captures how much p̂ varies across repeated samples from the same population. It is largest at p̂ = 0.5 (maximum uncertainty when outcomes are evenly split) and drops to zero as p̂ approaches 0 or 1. For 95% confidence, the margin of error is 1.96 × SE, and the CI is p̂ plus or minus that margin.
An example brings the numbers to life. A national poll surveys 1067 voters and finds 53% favor a policy. SE = √(0.53 × 0.47 / 1067) = 0.0153. ME = 1.96 × 0.0153 = 0.030 = ±3.0 percentage points. CI = [50.0%, 56.0%]. Notice how the conventional "n = 1000, ±3 points" rule of thumb falls out naturally from the formula.
P-hat sample size and accuracy
Margin of error scales as 1/√n. Quadruple the sample to halve the CI width. This is the iron law of polling and survey research. Going from n = 250 to n = 1000 cuts ME from ±6.2 points to ±3.1 points at 95% confidence — meaningful improvement. Going from n = 1000 to n = 4000 cuts it from ±3.1 to ±1.5 points — diminishing returns.
The required sample for a target margin of error is n = (z/ME)² × p̂(1−p̂), worst case at p̂ = 0.5. For ±3 points at 95%: n = (1.96/0.03)² × 0.25 = 1067. For ±1 point: n = (1.96/0.01)² × 0.25 = 9604. For ±0.5 points: 38,416. The election-eve mega-polls run by aggregators like 538 and RealClearPolitics combine multiple polls to reach effective sample sizes in the tens of thousands.
- n = 100: ±9.8 pp at 95% — too rough for political polling
- n = 384: ±5.0 pp at 95% — small academic survey
- n = 1067: ±3.0 pp at 95% — national poll standard
- n = 2401: ±2.0 pp at 95% — large national poll
- n = 9604: ±1.0 pp at 95% — exit-poll precision
- n = 38,416: ±0.5 pp at 95% — research-quality only
Common p-hat mistakes
The first error is confusing p̂ with p. Saying "p = 0.48" when you mean "p̂ = 0.48" elides the entire uncertainty. The hat is doing work — it signals that you have an estimate, not a fact. Statisticians notice. Reporters miss it constantly.
The second is using the Wald CI for small samples. When n·p̂ or n·(1−p̂) falls below 5, the normal approximation breaks. The CI can extend below 0 or above 1, which is nonsensical for a proportion. Wilson's score interval (1927) and the Clopper–Pearson exact binomial interval (1934) handle small samples and extreme proportions cleanly. The calculator flags Wald-invalid cases.
The third mistake is reporting p̂ ± SE rather than p̂ ± z·SE. The standard error alone is a one-standard-deviation band, about 68% confidence. The convention multiplies by z = 1.96 (for 95% CI).
The p-hat CI assumes your sample is a random draw from the population. Convenience samples, online opt-in panels, and self-selected respondents can produce tight CIs that systematically miss the true p by far more than the margin of error suggests. Polling failure in 2016 wasn't a CI problem — it was a sampling-frame problem.
A short history of proportion inference
Clopper and Egon Pearson published the first systematic treatment of the binomial confidence interval in 1934. Clopper and Pearson followed in 1934 with the exact interval that bears their names — still the gold standard for small samples. Wilson published his score-based interval in 1927; it was largely forgotten for 70 years before Agresti and Coull rediscovered it in 1998 and showed it outperformed the Wald approximation almost everywhere.
The Wald CI — the simple p̂ ± z · √(p̂q̂/n) — remained dominant in textbooks because it's easy to teach. Modern statistics software defaults to Wilson or Clopper–Pearson for proportions, especially in epidemiology and clinical trials where small samples and rare events are common. This calculator uses Wald with a normality warning, the choice most users expect.