Skip to content
Statistics

P-Hat Calculator (Sample Proportion)

Enter the number of successes and the sample size to get the sample proportion (p-hat), its standard error, and a confidence interval. Switch to z-score mode to convert a known p-hat into a test statistic against a claimed population proportion. All results include a step-by-step breakdown and a validity check for the normal approximation.

Your details

Choose whether to compute p-hat from raw counts, or test p-hat against a claimed proportion.
Count of individuals or trials with the characteristic of interest.
Total number of observations in the sample.
Confidence level for the proportion confidence interval.
p-hat (sample proportion)Normal approximation valid
0.45

Proportion of successes in the sample: x / n

Standard error0.0497
CI lower bound0.3525
CI upper bound0.5475
Z-score (test statistic)-
p-value (two-tailed)-
np validity check45
n(1-p) validity check55
0.45
Very rare<0.1Low0.1-0.3Moderate0.3-0.7High0.7-0.9Near-certain0.9+
00.310.6210205400
Sample size (n)
  • CI width (95%)
  • Standard error

p-hat = 0.4500 (45.00%)

  • Your sample proportion is 45.0%, meaning 45.0 out of every 100 observations show the characteristic.
  • The 95% confidence interval is 35.25% to 54.75%. You can be 95% confident the true population proportion falls in this range.

Next stepTo test whether your proportion differs from a specific value, switch to z-score mode and enter the null-hypothesis proportion.

What is p-hat and why does it matter?

In statistics, a hat over a symbol signals an estimate derived from data rather than a known parameter. The sample proportion p-hat (written p with a caret, or p-hat) is simply the fraction of individuals in a sample who have the characteristic you are studying. If you survey 200 voters and 110 say they support a policy, p-hat = 110 / 200 = 0.55. This single number is your best estimate of the true population proportion p, which you can rarely measure directly. Because every sample is different, p-hat varies from sample to sample around the true p, and that variability is what confidence intervals and hypothesis tests quantify.

Standard error and the confidence interval formula

The standard error (SE) of p-hat measures how much the sample proportion is expected to vary across repeated samples. The formula is SE = sqrt(p-hat * (1 - p-hat) / n). A larger sample shrinks the SE, pulling the CI tighter around p-hat. To build a confidence interval, you multiply the SE by a critical value z* that corresponds to your chosen confidence level: CI = p-hat plus or minus z* * SE. For 95% confidence, z* = 1.96. So if p-hat = 0.55, n = 200, SE = 0.0352, the 95% CI is roughly 0.481 to 0.619. That means you can be 95% confident the true proportion falls between 48.1% and 61.9%. This does not mean there is a 95% probability that p lies in that specific interval; it means the method produces an interval covering the true p in 95% of all possible samples.

Z-score hypothesis testing for a proportion

When you want to test a specific claim about the population proportion (the null hypothesis H0: p = p0), you convert the observed p-hat into a z-score test statistic: z = (p-hat - p0) / SE_null, where SE_null = sqrt(p0 * (1 - p0) / n) uses the null proportion rather than the sample proportion. If the absolute value of z is large, the sample result is unlikely under H0. The two-tailed p-value is the probability of seeing a z at least as extreme as yours purely by chance. A p-value below 0.05 is typically taken as evidence against H0 at the 5% significance level. For example, if 52% of 200 people support a measure but the null claim is 50%, z = (0.52 - 0.50) / sqrt(0.50 * 0.50 / 200) = 0.566, giving a p-value of about 0.57, nowhere near significant.

When is the normal approximation valid?

The confidence interval and z-test both rely on the fact that, for large n, p-hat follows an approximately normal distribution (by the Central Limit Theorem). The rule of thumb is that this approximation is reliable when both np-hat >= 10 and n(1 - p-hat) >= 10. If either condition fails, the tails of the true sampling distribution diverge from normal, and you should use an exact binomial confidence interval (the Clopper-Pearson interval) or Fisher exact test instead. This calculator flags the validity check in every result so you always know whether the normal approximation holds.

Common confidence levels and z critical values

Confidence levelz* (critical value)Interpretation
90%1.645 1 in 10 chance the true proportion falls outside the interval
95%1.960 1 in 20 chance the true proportion falls outside the interval
99%2.576 1 in 100 chance the true proportion falls outside the interval
99.9%3.291 1 in 1,000 chance the true proportion falls outside the interval

The z* value is multiplied by the standard error to compute the margin of error. Higher confidence requires a wider interval.

Frequently asked questions

What is the difference between p and p-hat?

p (without a hat) is the true population proportion, a fixed but usually unknown number. p-hat is the sample proportion you calculate from observed data. Because p-hat is an estimate based on a subset, it varies from sample to sample. The goal of statistical inference is to use p-hat to draw conclusions about p.

What does the confidence interval tell me?

A 95% confidence interval means that if you repeated your sampling procedure many times and built a 95% CI each time, about 95% of those intervals would contain the true proportion. It does not mean there is a 95% chance the true proportion is in your specific interval; once you have a specific interval from real data, the true proportion either is or is not in it.

How large does my sample need to be?

A common rule of thumb for the normal approximation to hold is n >= 30 and both np >= 10 and n(1-p) >= 10. For a preliminary p-hat of about 0.5 (the most conservative case), a sample of n = 100 satisfies both conditions easily. If you are estimating a very rare or very common proportion (near 0 or 1), you need a much larger n for the approximation to be safe.

Why does the z-score mode use p0 for the standard error instead of p-hat?

In hypothesis testing you are asking how likely your data would be if the null hypothesis were true. So the standard error is computed using p0 (the null proportion), not p-hat. This is called the null standard error. When computing a confidence interval you use p-hat in the standard error because you are estimating variability around the sample result, not around a hypothesized value.

What is a p-value and how do I interpret it?

The p-value is the probability of observing a sample proportion at least as far from the null value as yours, purely by chance, if H0 is true. A small p-value (typically < 0.05) means your result would be unusual if H0 were true, giving you reason to doubt H0. A large p-value means your data are consistent with H0. Note that a large p-value does not prove H0 is true; it only means you lack strong evidence against it.

Can p-hat be used in quality control?

Yes. In manufacturing and service quality, p-hat is used to estimate the defect rate. A sample of 500 items with 12 defects gives p-hat = 0.024, meaning about 2.4% of the process output is defective. Control charts for proportions (p-charts) track p-hat over time and flag when the process goes out of control, using control limits built from the standard error.

Sources

Written by Dr. Hannah Brandt, PhD Statistician · Munich, Germany

Applied statistician translating rigorous probability theory into clear, accurate tools for researchers and practitioners.

Search 3,500+ calculators

Loading search…