Statistics

P-value calculator

Report a bug

Share calculator

Add our free calculator to your website

Please enter a valid URL. Only HTTPS URLs are supported.

Use as default values for the embed calculator what is currently in input fields of the calculator on the page.
Input border focus color, switchbox checked color, select item hover color etc.

Please agree to the Terms of Use.
Preview

Save calculator

What Is a p-value?

A p-value quantifies the probability of observing results as extreme as those obtained in a study, assuming the null hypothesis (H₀) is true. It answers: “If the null hypothesis is true, how likely is my data?”

Key Definitions

  • Null Hypothesis (H₀): The default assumption (e.g., “no effect”).
  • Alternative Hypothesis (H₁): The claim being tested (e.g., “an effect exists”).
  • Test Statistic: A standardized value (e.g., Z-score, t-score) calculated from sample data.

Historical Context

The p-value was popularized by Ronald Fisher in the 1920s. Fisher suggested a threshold of 0.05 for statistical significance, a convention still debated today.

Formula

The p-value depends on the test statistic and the hypothesis test type:

General Formula

p-value={P(SxH0)(Left-tailed)P(SxH0)(Right-tailed)2×min{P(SxH0),P(SxH0)}(Two-tailed)\text{p-value} = \begin{cases} P(S \leq x \mid H₀) & \text{(Left-tailed)} \\ P(S \geq x \mid H₀) & \text{(Right-tailed)} \\ 2 \times \min\left\{P(S \leq x \mid H₀), P(S \geq x \mid H₀)\right\} & \text{(Two-tailed)} \end{cases}

where SS is the test statistic and xx is its observed value.

Z-test

For a Z-test with Z-score ZZ:

Z=Xˉμσ/nZ = \frac{\bar{X} - \mu}{\sigma / \sqrt{n}}
  • Left-tailed: Φ(Z)\Phi(Z)
  • Right-tailed: 1Φ(Z)1 - \Phi(Z)
  • Two-tailed: 2×Φ(Z)2 \times \Phi(-|Z|)

t-test

For a t-test with tt-score and df=n1df = n-1:

t=Xˉμs/nt = \frac{\bar{X} - \mu}{s / \sqrt{n}}
  • Left-tailed: T_df(t)T\_{df}(t)
  • Right-tailed: 1T_df(t)1 - T\_{df}(t)
  • Two-tailed: 2×T_df(t)2 \times T\_{df}(-|t|)

Chi-square (χ²) Test

For χ²-score with kk degrees of freedom:

  • Left-tailed: χ2_k(x)\chi²\_{k}(x)
  • Right-tailed: 1χ2_k(x)1 - \chi²\_{k}(x)

F-test

For F-score with (d1,d2)(d₁, d₂) degrees of freedom:

  • Left-tailed: F_d1,d2(x)F\_{d₁,d₂}(x)
  • Right-tailed: 1F_d1,d2(x)1 - F\_{d₁,d₂}(x)

Examples

Example 1: Z-test for Population Mean

Scenario: A factory claims lightbulbs last 1,200 hours. A sample of 50 bulbs has Xˉ=1,180\bar{X} = 1,180, σ=100\sigma = 100. Test if the mean is less than claimed.
Solution:

Z=1,1801,200100/501.414Z = \frac{1,180 - 1,200}{100 / \sqrt{50}} \approx -1.414
  • Left-tailed p-value: Φ(1.414)0.078\Phi(-1.414) \approx 0.078.
    Conclusion: Fail to reject H₀ at α=0.05\alpha = 0.05.

Example 2: Chi-square Test for Independence

Scenario: A survey tests if gender (Male/Female) and preference (Yes/No) are independent. Observed χ² = 6.25, df=1df = 1.
Solution:

  • Right-tailed p-value: 1χ2_1(6.25)0.0121 - \chi²\_{1}(6.25) \approx 0.012.
    Conclusion: Reject H₀ at α=0.05\alpha = 0.05.

Interpretation Guide

  • p-value < 0.01: Strong evidence against H₀.
  • 0.01 ≤ p-value < 0.05: Moderate evidence against H₀.
  • p-value ≥ 0.05: Insufficient evidence to reject H₀.

Common Misconceptions

  1. Myth: A high p-value “proves” H₀.
    Truth: It only suggests insufficient evidence against H₀.
  2. Myth: p-value = Probability H₀ is true.
    Truth: p-value assumes H₀ is true; it does not measure H₀’s likelihood.

Frequently Asked Questions

Can a p-value be negative?

No. P-values represent probabilities and must be between 0 and 1.

How to interpret a p-value of 0.07?

At α=0.05\alpha = 0.05, you fail to reject H₀. However, this result is marginally significant and warrants further study.

Why is 0.05 a common significance level?

Popularized by Fisher, 0.05 balances Type I error (false positives) and sensitivity. However, it’s arbitrary and field-dependent (e.g., physics uses 5σ5\sigma, p3×107p \approx 3 \times 10^{-7}).

How does sample size affect p-values?

Larger samples increase test sensitivity, making it easier to detect small effects. Always report effect size (e.g., Cohen’s d) alongside p-values.

What’s the difference between one-tailed and two-tailed tests?

  • One-tailed: Tests for an effect in one direction (e.g., “greater than”).
  • Two-tailed: Tests for any directionless effect. Uses 2×2 \times the tail probability.