AP subjects/AP Statistics/P-Value Visualizer
CED 3.6AP Statistics

P-Value Visualizer

Use this free p-value visualizer to see a P-value as the shaded tail area under the standard normal curve beyond your test statistic. Choose the alternative hypothesis and significance level, and it tells you whether to reject H0H_0.

Controls
z

How to use the simulator

The simulator has one slider and two rows of buttons:
  • Observed statistic (z): −4 to 4 in steps of 0.01, starting at 1.96. Enter the standardized test statistic you calculated.
  • Alternative hypothesis (tail): Left (Ha: p < p0), Right (Ha: p > p0, the default) or Two-sided (Ha: p ≠ p0).
  • Significance level (α): 0.10, 0.05 (default) or 0.01.
The plot is the null distribution: a standard normal curve from −4 to 4. The P-value region is shaded in coral, and a dashed coral line marks z (plus −z in two-sided mode, where both tails are shaded). Faint dashed lines mark ±1.645, ±1.96 and ±2.576, the critical values for common levels.
The results box lists the Test statistic, the P-value with how it was found (P(Z ≤ z), P(Z ≥ z) or 2·P(Z ≥ |z|)) to four decimals, or "< 0.0001" when tiny, and α. A verdict bar then reads either REJECT H0 (statistically significant) or FAIL TO REJECT H0 (not significant).
The verdict compares the unrounded P-value with α. At z = 1.96 two-sided, the box shows 0.0500 but the verdict says reject, because the unrounded value is 0.049996. On real work, report the P-value and compare it with α yourself.
Slide z toward 0 and the shaded area grows. At z = 0, the right-tailed P-value is 0.5000 and the two-sided P-value is 1.0000: a statistic right at the center of the null distribution is no evidence against H0H_0 at all.
Try z = 1.96 with Right, then with Two-sided: the P-value doubles from 0.0250 to 0.0500. The same statistic is less convincing when the alternative did not predict a direction.

The formula

For a one-sample z-test for a proportion with null hypothesis H0 ⁣:p=p0H_0\colon p = p_0:
z=p^−p0p0(1−p0)nz = \frac{\hat{p} - p_0}{\sqrt{\dfrac{p_0(1-p_0)}{n}}}
This is the formula sheet's standardized test statistic, (statistic − parameter)/(standard error of the statistic). The standard error uses p0p_0, because the test assumes H0H_0 is true.
  • Right-tailed (Ha ⁣:p>p0H_a\colon p > p_0): P-value =P(Z≥z)= P(Z \ge z).
  • Left-tailed (Ha ⁣:p<p0H_a\colon p < p_0): P-value =P(Z≤z)= P(Z \le z).
  • Two-sided (Ha ⁣:p≠p0H_a\colon p \ne p_0): P-value =2P(Z≥∣z∣)= 2P(Z \ge |z|).
The P-value is the probability, assuming H0H_0 is true, of getting a statistic at least as extreme as the one observed, in the direction of HaH_a. If P-value <α< \alpha, reject H0H_0: there is convincing evidence for HaH_a. If P-value ≥α\ge \alpha, fail to reject H0H_0: there is not convincing evidence for HaH_a.

Worked example

Problem: A phone company says 60% of its customers would recommend it. A manager suspects the true proportion is higher. In a random sample of 200 customers, 132 would recommend it. Test at α=0.05\alpha = 0.05.
Step 1: Hypotheses. H0 ⁣:p=0.60H_0\colon p = 0.60 and Ha ⁣:p>0.60H_a\colon p > 0.60, where pp is the proportion of all the company's customers who would recommend it.
Step 2: Conditions. Random sample; 200 is less than 10% of all customers; np0=200(0.60)=120np_0 = 200(0.60) = 120 and n(1−p0)=200(0.40)=80n(1-p_0) = 200(0.40) = 80, both at least 10.
Step 3: Test statistic. p^=132/200=0.66\hat{p} = 132/200 = 0.66. σp^=0.60(0.40)/200≈0.0346\sigma_{\hat{p}} = \sqrt{0.60(0.40)/200} \approx 0.0346, so z=(0.66−0.60)/0.0346≈1.73z = (0.66 - 0.60)/0.0346 \approx 1.73.
Step 4: P-value. P(Z≥1.73)≈0.0418P(Z \ge 1.73) \approx 0.0418. If 60% of customers really would recommend the company, there is about a 4.2% chance that a random sample of 200 gives a p^\hat{p} of 0.66 or higher.
Step 5: Conclude. Because 0.0418<0.050.0418 < 0.05, reject H0H_0. There is convincing evidence that more than 60% of the company's customers would recommend it.
Check it in the simulator: set z to 1.73 with Right and α = 0.05. The P-value reads 0.0418 and the verdict is REJECT. Click α = 0.01: the same P-value now gives FAIL TO REJECT. Click Two-sided: the P-value doubles to 0.0836, which would not be significant at 0.05.

Common mistakes on the AP exam

  • "The P-value is the probability that H0 is true." It is calculated assuming H0H_0 is true. It is the probability of data this extreme, not of the hypothesis.
  • "Accept H0." A large P-value means the data are consistent with H0H_0, not that H0H_0 is proven. Say "fail to reject."
  • Picking the tail from the data. The direction comes from HaH_a, stated before you see the results, not from the sign of zz.
  • Forgetting to double for two-sided tests. 2P(Z≥∣z∣)2P(Z \ge |z|), not P(Z≥∣z∣)P(Z \ge |z|).
  • Using p^\hat{p} in the test's standard error. Tests use p0p_0; confidence intervals use p^\hat{p}.
  • Comparing z with α. Compare the P-value with α, or z with a critical value, never z with α.
  • A conclusion with no link or context. Write "Because P-value = 0.0418 < α = 0.05, we reject H0H_0" and then state the evidence about pp in context.

When the AP exam uses this

P-values are topic 3.6, part of significance tests for a population proportion. Free-response questions regularly ask you to carry out a full test, or to interpret a given P-value in context, which means stating the assumption that H0H_0 is true, the observed result, and the direction of HaH_a.
Embed this simulator on your class page

Free for classroom use. Paste this into your site, LMS page or blog; keep the credit link under it.