Lelifi·tools

P-Hat Calculator

Divide the successes by the sample size: 96 free throws in 150 attempts give p-hat = 0.64, or 64 percent. The standard error is 0.0392, from 0.64 times 0.36 over 150, so a 95 percent interval runs from 56.32 to 71.68 percent.

Type the successes and the sample size. You get p-hat as a decimal and a percent, the standard error, the margin of error and the interval at your confidence level, with the Wilson interval as a cross check near the edges.

Enter successes and sample size to get p-hat as a decimal and a percent, its standard error, and the interval around it at your chosen confidence level.

By the Lelifi editors ·

Key takeaways

Width of the 95 percent interval for a 64 percent shareEach bar is the full interval width, in percentage pointsn = 3830.5 pointsn = 15015.4 pointsn = 6007.7 pointsn = 24003.8 pointsFour times the sample halves the width. Going from 600 to 2400 buys 3.8 points, not 7.7.
The 95 percent interval for a 64 percent share narrows from 30.5 points at 38 attempts to 3.8 points at 2400, and each halving of the width costs four times the sample.
Two intervals for the same 2 of 20 sampleThe plain interval steps below zero; the Wilson interval stays between 0 and 100 percentp-hat = 10 percentPlain 95-3.123.1Wilson 952.830.1-100102030percentSame data, same confidence. The Wilson formula shifts the center upward instead of promising a negative share.
For 2 makes in 20 attempts the plain 95 percent interval runs from minus 3.1 to 23.1 percent, dipping below zero, while the Wilson interval for the same data sits between 2.8 and 30.1 percent.
On this page
  1. What p̂ is, and why the hat matters
  2. A worked example: free throws in practice
  3. The standard error of p̂
  4. How big the sample must be before the interval is honest
  5. From p̂ to a margin of error, step by step
  6. p̂, p and p0: keeping the letters straight
  7. How many observations a target margin demands
  8. Two p̂ values side by side

What p̂ is, and why the hat matters

The letter p stands for the true share in the whole population: the share of all voters who back a candidate, the share of all bulbs a line makes that pass inspection, the share of all free throws a player will ever take that go in. You almost never get to see p directly, because checking every member of a population costs too much. What you see is a sample, and from the sample you compute p̂, written p with a small caret, or hat, above it. The hat is the standard marker for an estimated value.

The arithmetic is one division: p̂ equals the number of successes divided by the sample size. In a class of 28 students where 11 walk to school, p̂ is 11 ÷ 28 = 0.3929, or about 39.3 percent. Every number on this page starts from that single division; everything after it is a way of saying how far the estimate could sit from the truth.

That distance is the reason the hat exists. A different class of 28 would give a different p̂ even if the underlying walking habit were identical. The rest of this page shows how much the estimate can wobble, and what to do about the wobble.

A worked example: free throws in practice

A player takes 150 free throws across two weeks of drills and makes 96. The sample proportion is 96 ÷ 150 = 0.64, so p̂ is 0.64, or 64 percent. The misses matter just as much to the math: 54 of 150, which is 54 ÷ 150 = 0.36. The two shares add to 1, which they must, because every attempt lands in one of the two buckets.

QuantityCountShare
Makes960.64
Misses540.36
Attempts1501.00

One more number comes out of this example and drives the rest of the page: the product of p̂ and (1 minus p̂), which is 0.64 × 0.36 = 0.2304. This product measures how mixed the outcomes are. It is largest when p̂ sits near 0.5, where results are hardest to call, and it shrinks toward 0 as p̂ approaches either end, where nearly every attempt has the same result.

The standard error of p̂

The standard error says how far p̂ typically falls from the true p when the sampling is repeated. For a proportion the formula is the square root of p̂ times (1 minus p̂), divided by n. For the free throws that is 0.2304 ÷ 150 = 0.001536, and the square root of 0.001536 is 0.0392. In repeated samples of 150 attempts, the estimates would land within about 3.9 points of the true shooting rate most of the time.

The square root is what makes sample size expensive. Four times the data cuts the standard error in half, so each extra digit of precision costs a multiple of the one before it.

Sample size nStandard error at p̂ = 0.6495 percent interval width
380.077930.5 points
1500.039215.4 points
6000.01967.7 points
24000.00983.8 points

Read the table as a planning tool. If a margin near 4 points is good enough, 150 attempts will do. Tightening to 2 points asks for 600, and 1 point asks for 2400. The Penn State statistics course notes cover the same sampling distribution for sample proportions in their lesson on sampling distributions.

How big the sample must be before the interval is honest

The interval on this page uses the normal curve, and the normal curve is only a good stand-in when both outcomes show up enough. The usual rule asks for at least 10 expected successes and 10 expected failures: n times p̂ of at least 10, and n times (1 minus p̂) of at least 10. The free throws clear it easily, with 96 makes and 54 misses against a bar of 10.

A sample with 2 makes out of 20 fails the rule on both ends. The plain interval still computes, but its lower limit works out to minus 3.1 percent, and a share cannot be negative. The Wilson interval fixes this by feeding the counts through a formula that always stays between 0 and 1: for the 2 of 20 sample it reads about 2.8 to 30.1 percent, shifted upward, and that shift is the honest price of so little evidence. The Wikipedia article on the binomial proportion confidence interval lists the Wilson version alongside the alternatives.

Independence matters as much as size. If every attempt in the sample comes from one hot streak, or every surveyed household comes from one block, the formulas see n separate observations where the data hold far fewer. No interval formula can repair a sample that was not drawn independently.

From p̂ to a margin of error, step by step

A school district surveys 500 families about packed lunches and hears yes from 312. The steps run the same way as the free throws.

p̂ is 312 ÷ 500 = 0.624. The spread product is 0.624 × 0.376 = 0.2346, and dividing by 500 gives 0.2346 ÷ 500 = 0.000469, whose square root is 0.0217. At 95 percent confidence the multiplier is 1.96, so the margin is 1.96 × 0.0217 = 0.0425, or 4.25 points. The interval runs from 58.2 to 66.6 percent.

Each step exists so the next one can check it. The two shares must add to 1, the product must sit below 0.25, and the interval must be centered on p̂ itself: 62.4 minus 4.25 and 62.4 plus 4.25 reproduce the printed ends. If any check fails, a key was mistyped somewhere upstream.

The same survey at 99 percent confidence uses 2.5758 instead of 1.96, which lifts the margin to 5.58 points. Confidence is bought with width: the 99 percent interval spans 11.2 points against 8.5 for the 95 percent one.

p̂, p and p0: keeping the letters straight

Three symbols cover the whole story. Lowercase p is the population truth, whatever it is. p̂ is your estimate from the sample. p0 (p nought, or p zero) is a claimed or target value that a test compares against. They play different roles, and mixing them up is the most common notation error in homework and in reports.

Suppose a delivery firm claims 90 percent of shipments arrive on time, so p0 is 0.9. You track 200 shipments and see 171 on time, so p̂ is 171 ÷ 200 = 0.855. The gap is 0.9 - 0.855 = 0.045, which is 4.5 points. The standard error at p̂ of 0.855 works out to about 0.0249, so the gap is roughly 1.8 standard errors. That is close enough to the usual 1.96 cutoff that a larger sample is the honest next move, and it is why the claim itself, p0, gets a letter of its own.

Keep the estimate and the claim apart when you write. Saying that the on-time rate is 85.5 percent reports p̂. Saying that the data are consistent with the 90 percent claim compares p̂ with p0 through the standard error. The first is a measurement; the second is a judgment, and the two need different sentences.

How many observations a target margin demands

Run the interval formula backwards and sample size planning becomes one division. At 95 percent confidence the multiplier is 1.96 and its square is 3.8416, so the margin m satisfies m = 1.96 times the square root of p̂ times (1 minus p̂) over n. Solving for n gives n = 3.8416 × p̂ × (1 minus p̂) ÷ m², with m written in decimal form, so a 3 point margin is 0.03.

The only guess planning must make is p̂ itself, and the safe guess is 0.5, where the spread product peaks at 0.25. The table below shows the sample sizes that two different guesses demand at four margins.

Target marginn if p̂ is 0.5n if p̂ is 0.64
5 points (0.05)385355
3 points (0.03)1,068984
2 points (0.02)2,4012,213
1 point (0.01)9,6048,852

The two columns sit within 9 percent of each other because 0.64 lies close to 0.5. Planning around a proportion near the edge saves far more: at p̂ = 0.9 the spread product drops to 0.09, and the 3 point margin needs 385 observations instead of 1,068. When nothing is known about the proportion, budget for 0.5; when past data point toward an edge, the saving is large enough to plan around.

A pilot of 40 to 60 observations settles the guess cheaply. The pilot's own interval is wide, but even a rough p̂ separates the 385 row of the table from the 9,604 row, and that separation is worth more than any extra digit of precision inside the pilot itself.

Two p̂ values side by side

Comparisons need a standard error of their own. Alongside the free throw drills from earlier, 96 makes in 150 attempts, suppose a second block of drills produces 78 makes in 140. The first p̂ is 0.64, the second is 78 ÷ 140 = 0.5571, and the gap between them is 0.0829, or 8.3 points. The question is whether that gap is signal or sampling noise.

The standard error of the difference is the square root of the two squared standard errors added together. Sample A contributes 0.64 × 0.36 ÷ 150 = 0.001536 and sample B contributes 0.5571 × 0.4429 ÷ 140 = 0.001762. The sum is 0.003298 and its square root is 0.0574. Dividing the gap by the standard error gives 0.0829 ÷ 0.0574 = 1.44, short of the 1.96 cutoff, so samples this size cannot separate a 64 percent shooter from a 56 percent one.

QuantitySample ASample B
Successes9678
Sample size150140
p̂0.640.5571
Squared standard error0.0015360.001762

The null result carries information of its own. It says the data are too thin to support a claim in either direction, not that the shooters are identical. To detect a gap of 8 points at 95 percent confidence, each arm needs about 270 observations when the true rates sit near 0.6, since a two sample test spreads the same margin arithmetic across both groups.

Frequently asked questions

What does p̂ mean in statistics?

It is the proportion measured in your sample, marked with a caret to show it is an estimate. A player who makes 96 of 150 free throws has p̂ = 0.64, while the true season rate, p, stays unknown until the season ends.

How do you calculate p-hat?

Divide the successes by the sample size: 96 ÷ 150 = 0.64. As a percent that is 64 percent. No other inputs are needed.

What is the difference between p and p-hat?

p is the fixed population value and p-hat is the estimate that bounces from sample to sample. With n = 150 and p-hat = 0.64, the standard error of 0.0392 describes how far a fresh sample's estimate would typically sit from p.

What is the standard error of p-hat for 96 out of 150?

Multiply 0.64 by 0.36 to get 0.2304, divide by 150 to get 0.001536, and take the square root: 0.0392. In percentage points that is about 3.9.

How do I build a 95 percent interval around p-hat?

Add and subtract 1.96 standard errors: 1.96 × 0.0392 = 0.0768, so the interval for 0.64 runs from 56.32 to 71.68 percent.

How large a sample does the p-hat interval need?

At least 10 expected successes and 10 expected failures. With p-hat near 0.5 that means about 20 observations; with p-hat near 0.9 it means about 100, since failures become the scarce group.

Can p-hat be negative or larger than 1?

No. It is a count divided by a count, so it stays between 0 and 1. The endpoints are legal: 0 of 30 gives p̂ = 0, though an interval there needs the Wilson formula.

Why does the Wilson interval matter for p-hat?

Near the edges the plain interval can step outside 0 and 1. For 2 makes in 20 attempts the plain lower limit is minus 3.1 percent, while the Wilson interval reads 2.8 to 30.1 percent.

Does p-hat get closer to p as the sample grows?

On average, yes, at a known speed: quadrupling n halves the standard error. The free throw estimate moves from 0.0392 at n = 150 to 0.0196 at 600 and 0.0098 at 2400.

Is p-hat the same as a percentage?

The same number in different clothing: p-hat of 0.64 and 64 percent describe one proportion. Report either, but keep the decimal form inside any further arithmetic, since the standard error formula expects it.

How many decimal places should I report for p-hat?

Four decimals for the proportion and two for the percent usually serve. Keep more decimals in the standard error than in the interval you print, or rounding noise leaks into the endpoints.

What is p0, and how is it different from p-hat?

p0 is the value a claim proposes, such as 0.9 for a 90 percent on-time promise, while p-hat is what your sample saw, such as 0.855 from 171 of 200 shipments. Tests compare the two through the standard error.

What if my observations are clustered?

Then the effective sample is smaller than n and the printed interval is too narrow. Ten households answering about their shared commute count closer to one observation than ten. Random, independent sampling is a precondition, not a nicety.

Spotted a wrong number or a broken result?

More Everyday tools

See all Everyday tools

Fee schedules, rates and rules change without notice. Always confirm important figures with the official source before you rely on them.