One Proportion Z-Test
Calculator
Input Your Values
Learn More
One-Proportion Z-Test
Definition
One-Proportion Z-Test is used to test if a population proportion is significantly different from a hypothesized value. It's commonly used for analyzing success rates, percentages, or proportions in a single group.
Formula
Test Statistic:
Where:
- = sample proportion
- = hypothesized population proportion
- = sample size
Confidence Interval:
Where and are the critical values for the desired confidence level.
Key Assumptions
Common Pitfalls
- Using the test when sample size conditions aren't met
- Not checking for independence of observations
- Confusing statistical significance with practical importance
Practical Example
Testing if a new manufacturing process meets quality standards:
Step 1: State the Data
- Sample size: = 100 units
- Defect-free units: = 45 units
- Sample proportion:
Step 2: State Hypotheses
- (standard quality level)
- (different from standard)
Step 3: Calculate Test Statistic
Z-statistic:
Step 4: Calculate P-value
For two-tailed test:
Step 5: Calculate Confidence Interval
Step 6: Draw Conclusion
Critical value at 5% significance level:
Since and , we fail to reject . There is insufficient evidence to conclude that the process quality differs from the standard level.
Effect Size
Cohen's h for one proportion:
Interpretation:
- Small effect:
- Medium effect:
- Large effect:
Power Analysis
Required sample size for desired power:
Where:
- = alternative proportion
- = Type II error rate
- = significance level
Code Examples
1x <- 45 # Number of successes
2n <- 100 # Number of trials
3p <- 0.5 # Null hypothesis proportion
4
5# Perform one-proportion test
6result <- prop.test(
7 x = x,
8 n = n,
9 p = p,
10 alternative = "two.sided",
11 correct = FALSE # No continuity correction
12)
13
14# Print results
15print(result)
1from statsmodels.stats.proportion import proportions_ztest
2import numpy as np
3from scipy import stats
4
5# Example data
6p0 = 0.5
7success1, n1 = 45, 100
8p1 = success1 / n1
9
10# Perform one-proportion z-test
11zstat, pvalue = proportions_ztest(
12 success1, n1, value=p0, alternative='two-sided'
13)
14
15print(f'z-statistic: {zstat:.4f}')
16print(f'p-value: {pvalue:.4f}')
17
18# construct confidence interval
19alpha = 0.05
20z_critical = stats.norm.ppf(1 - alpha / 2)
21margin_of_error = z_critical * np.sqrt((p1 * (1 - p1) / n1))
22prop_diff = p1
23ci_lower = prop_diff - margin_of_error
24ci_upper = prop_diff + margin_of_error
25print(f'Confidence interval: ({ci_lower:.4f}, {ci_upper:.4f})')
Alternative Tests
Consider these alternatives when assumptions are violated:
- Exact Binomial Test: For small samples
- Chi-square Goodness of Fit: For categorical data
- Bootstrap Methods: When sample size conditions aren't met
Related Calculators
Contingency Table Calculator
Two Proportion Z-Test Calculator
Sample Size Calculator
Chi-Square Test for Goodness of Fit Calculator
Help us improve
Found an error or have a suggestion? Let us know!