- p = observed sample proportion
- p0 = hypothesized population proportion
- n = sample size
z-statistic: 0.55487
p-value (one-tailed): 0.28949
p-value (two-tailed): 0.57898
95% C.I. = [0.2914, 0.6486]
What is the Significance of the One Proportion Z-Test?
The one proportion z-test serves as a key statistical tool for analyzing categorical data. It allows researchers to determine if an observed sample proportion differs meaningfully from a claimed or expected population proportion. This test forms the basis for quality control processes, opinion polling accuracy assessment, and hypothesis testing in various research fields.
The test relies on the normal approximation to the binomial distribution, making it suitable when dealing with binary outcomes (success/failure, yes/no, present/absent). By calculating a standardized z-statistic, the test provides a way to measure how many standard deviations the sample proportion falls from the hypothesized value.
When to Use the One Proportion Z-Test Calculator
This calculator is particularly helpful in the following scenarios:
- Testing claims about population proportions (e.g., testing if the proportion of voters supporting a candidate differs from 50%)
- Quality control processes where you need to verify if defect rates match expected standards
- Medical research comparing observed treatment success rates against established baselines
- Market research validating if consumer preference proportions align with expected values
For accurate results, your data should meet these conditions:
- The sample consists of independent observations
- The sample size is sufficiently large (np₀ ≥ 5 and n(1-p₀) ≥ 5)
- The data represents a random sample or can be treated as such
Example of Using the Calculator
Suppose a pharmaceutical company claims that 60% of patients experience relief from a new medication. In a clinical trial with 50 patients, researchers observe that 25 patients (50%) report relief. Is this proportion significantly different from the claimed 60%?
Input:
- p₀ (hypothesized population proportion) = 0.60
- p (observed sample proportion) = 0.50
- n (sample size) = 50
After clicking “Calculate,” the results show:
- z-statistic: -1.44338
- p-value (one-tailed): 0.07446
- p-value (two-tailed): 0.14891
- 95% C.I. = [0.3614, 0.6386]
Interpretation: The two-tailed p-value (0.14891) exceeds the typical significance level of 0.05. This means we don’t have sufficient evidence to reject the company’s claim that the relief rate is 60%. The 95% confidence interval includes the value 0.60, further supporting this conclusion. However, with a one-tailed p-value of 0.07446, there’s some weak evidence that the true proportion might be less than 60%, though not quite at the standard 0.05 significance level.
Frequently Asked Questions
Q: What’s the difference between one-tailed and two-tailed p-values?
A: A one-tailed p-value tests the hypothesis that the sample proportion is either greater than or less than the hypothesized value (but not both). A two-tailed p-value tests if the sample proportion differs from the hypothesized value in either direction. Use one-tailed tests when you have a specific directional hypothesis and two-tailed tests when you’re testing for any difference.
Q: How large should my sample size be for this test?
A: For the normal approximation to be valid, both np₀ and n(1-p₀) should be at least 5. For example, if your hypothesized proportion p₀ is 0.1, you would need at least 50 observations to meet this requirement. With values closer to 0.5, smaller samples can be adequate. For very small samples or extreme proportions, exact methods like the binomial test may be more appropriate.
Q: How do I interpret the confidence interval in relation to the hypothesis test?
A: The confidence interval provides a range of plausible values for the true population proportion. If your hypothesized value p₀ falls within the confidence interval, this aligns with failing to reject the null hypothesis at the corresponding significance level. If p₀ falls outside the interval, this corresponds to rejecting the null hypothesis. The confidence interval offers additional insight into the precision of your estimate beyond the binary decision from the hypothesis test.
Hello Zach, I am in an MPH program and I am trying to determine the correct statistical method to measure the difference between two intervention outcomes. Would a one-proportion z-test be appropriate for the following example. I believe that I am trying to compare dichotomous data (being vaccinated or not between two intervention strategies).
For example:
I want to test the difference of vaccination rates before and after a public health intervention. The intervention is a pharmacist-run vaccine clinic.
In 2023, vaccine rate was 3.3% with traditional methods (no intervention).
In 2024, estimated vaccine rate will be 50% with the intervention of pharmacist-run vaccine clinics.
I calculate P (observed vaccinated population in 2023) = 3.3% (5906 total population / 195 total people vaccinated)
P0 (hypothesized vaccinated population in 2024) = 50% (5906 total population / 2953 total people vaccinated)
n (number size) = 5906 total population had choice to being vaccinated.
I greatly appreciate your guidance.
Hi Glenn…To compare the vaccination rates before and after a public health intervention, a statistical test like the two-proportion z-test would be appropriate. This test compares the proportions of two groups to determine if there is a significant difference between them.
Here’s a step-by-step guide to using the two-proportion z-test for your scenario:
### Hypotheses
– **Null Hypothesis (H0)**: There is no difference in the vaccination rates before and after the intervention.
\[
H_0: p_1 = p_2
\]
– **Alternative Hypothesis (H1)**: There is a difference in the vaccination rates before and after the intervention.
\[
H_1: p_1 \neq p_2
\]
### Data
– **Before Intervention (2023)**:
– Proportion vaccinated: \( p_1 = 3.3\% = \frac{195}{5906} \)
– Sample size: \( n_1 = 5906 \)
– **After Intervention (2024)**:
– Proportion vaccinated: \( p_2 = 50\% = \frac{2953}{5906} \)
– Sample size: \( n_2 = 5906 \)
### Test Statistic
The test statistic for the two-proportion z-test is calculated using the formula:
\[
z = \frac{(p_1 – p_2)}{\sqrt{p(1 – p) \left(\frac{1}{n_1} + \frac{1}{n_2}\right)}}
\]
Where \( p \) is the pooled sample proportion:
\[
p = \frac{x_1 + x_2}{n_1 + n_2}
\]
And \( x_1 \) and \( x_2 \) are the number of successes in each sample:
\[
x_1 = 195 \quad \text{and} \quad x_2 = 2953
\]
### Calculations
1. **Calculate the pooled proportion (p)**:
\[
p = \frac{195 + 2953}{5906 + 5906} = \frac{3148}{11812} \approx 0.2664
\]
2. **Calculate the standard error (SE)**:
\[
SE = \sqrt{0.2664 \times (1 – 0.2664) \left(\frac{1}{5906} + \frac{1}{5906}\right)}
\]
3. **Calculate the z-score**:
\[
z = \frac{(0.033 – 0.50)}{\sqrt{0.2664 \times 0.7336 \left(\frac{2}{5906}\right)}}
\]
Let’s compute these values:
“`python
import math
# Given data
p1 = 195 / 5906
p2 = 2953 / 5906
n1 = 5906
n2 = 5906
# Pooled proportion
p = (195 + 2953) / (5906 + 5906)
# Standard error
SE = math.sqrt(p * (1 – p) * (1/n1 + 1/n2))
# Z-score
z = (p1 – p2) / SE
z
“`
### Interpretation
1. **Compute the p-value**: The p-value can be obtained using standard normal distribution tables or software.
2. **Compare the p-value with the significance level (α)**: Typically, α is set at 0.05. If the p-value is less than α, reject the null hypothesis.
### Example Calculation in Python
“`python
import scipy.stats as stats
# Given data
p1 = 195 / 5906
p2 = 2953 / 5906
n1 = 5906
n2 = 5906
# Pooled proportion
p = (195 + 2953) / (5906 + 5906)
# Standard error
SE = math.sqrt(p * (1 – p) * (1/n1 + 1/n2))
# Z-score
z = (p1 – p2) / SE
# P-value
p_value = 2 * (1 – stats.norm.cdf(abs(z)))
z, p_value
“`
The output will give you the z-score and the p-value. Based on the p-value, you can make a decision about the null hypothesis.
### Conclusion
Using the two-proportion z-test will allow you to determine if there is a statistically significant difference between the vaccination rates before and after the intervention. If the p-value is below your significance threshold (commonly 0.05), you can conclude that the intervention had a significant impact on the vaccination rates.