Enter the z-score to calculate the p-value. Select one-tailed or two-tailed and specify the significance level to determine if your result is statistically significant.
P-Value:
Understanding Z-Scores, P-Values, and Hypothesis Testing
1. What is a Z-Score?
A Z-score (or standard score) tells us how many standard deviations an observation or data point is from the mean of a distribution. It's calculated using the formula:
where \( X \) is the observed value, \( \mu \) is the population mean, and \( \sigma \) is the population standard deviation.
2. Converting Z-Scores to P-Values
The P-value represents the probability of obtaining results as extreme as the observed results, assuming the null hypothesis is true. For a given Z-score, the P-value depends on the type of test:
- One-tailed test: \( \text{P-value} = 1 - \Phi(|Z|) \) for an upper-tailed test, or \( \Phi(-|Z|) \) for a lower-tailed test, where \( \Phi \) is the cumulative distribution function (CDF) of the standard normal distribution.
- Two-tailed test: \( \text{P-value} = 2(1 - \Phi(|Z|)) \), which accounts for both tails of the distribution.
3. Cumulative Distribution Function (CDF) for the Standard Normal Distribution
The CDF of the standard normal distribution, \( \Phi(Z) \), gives the probability that a standard normal variable is less than or equal to a given Z-score. It represents the area under the normal curve up to the specified Z value.
To compute \( \Phi(Z) \), here are common approaches:
- Statistical Tables: Use a Z-table to find the probability values for different Z-scores.
- Software: Most statistical software and libraries include a CDF function:
- Python:
scipy.stats.norm.cdf(z_score)
- Excel:
=NORM.S.DIST(z_score, TRUE)
- JavaScript (jStat):
jStat.normal.cdf(z_score, 0, 1)
- Python:
- Formula Approximation: The CDF can also be approximated by:
\( \Phi(Z) \approx 0.5 \left(1 + \text{erf}\left(\frac{Z}{\sqrt{2}}\right)\right) \)where
erf
is the error function.
4. Interpreting the Results
In hypothesis testing, we compare the P-value to a significance level (α) to decide whether to reject the null hypothesis (H₀):
- If \( \text{P-value} < \alpha \): Reject the null hypothesis (suggesting the observed result is statistically significant).
- If \( \text{P-value} \geq \alpha \): Fail to reject the null hypothesis (the result is not statistically significant).
Common significance levels are 0.05 and 0.01.
Real-Life Example: Manufacturing Quality Control
Imagine a factory producing screws with:
- Target length (\( \mu \)) = 5 cm
- Standard deviation (\( \sigma \)) = 0.1 cm
- Significance level (\( \alpha \)) = 0.05
One-Tailed Example (Upper-tail):
Testing if a 5.1 cm screw is significantly longer than the target:
- State hypotheses:
- H₀: μ = 5 cm
- H₁: μ > 5 cm
- Calculate Z-score:
Z = (5.1 - 5) / 0.1 = 1.0 - Find P-value:
P-value = 1 - Φ(1.0) = 0.1587 - Decision:
Since 0.1587 > 0.05, fail to reject H₀
Two-Tailed Example:
Testing if a 5.2 cm screw significantly differs from the target:
- State hypotheses:
- H₀: μ = 5 cm
- H₁: μ ≠ 5 cm
- Calculate Z-score:
Z = (5.2 - 5) / 0.1 = 2.0 - Find P-value:
P-value = 2(1 - Φ(2.0)) = 2(0.0228) = 0.0456 - Decision:
Since 0.0456 < 0.05, reject H₀