z-test Proportions
When comparing the proportions of a specific outcome between two groups—such as the conversion rates for two versions of a website—a z-test for proportions is a powerful tool.
A z-test for proportions helps you determine whether the difference between two observed proportions is statistically significant, or if it could have occurred by random chance.
Key applications:
- A/B testing for product or website changes;
- Clinical trials comparing treatment effects;
- Survey analysis with binary outcomes (such as success/failure or yes/no).
You should use a z-test for proportions when:
- You have large sample sizes;
- Your data represent binary outcomes.
This test is essential for making confident decisions when evaluating differences between groups.
123456789101112131415161718192021222324252627282930313233import numpy as np from scipy.stats import norm # Sample data: Group A and Group B # Let's say you run an A/B test for a new signup page. # Group A (control): 120 signups out of 600 visitors # Group B (variant): 150 signups out of 700 visitors success_a = 120 n_a = 600 success_b = 150 n_b = 700 # Calculate sample proportions p_a = success_a / n_a p_b = success_b / n_b # Pooled proportion p_pool = (success_a + success_b) / (n_a + n_b) # Standard error se = np.sqrt(p_pool * (1 - p_pool) * (1/n_a + 1/n_b)) # z-statistic z = (p_a - p_b) / se # Two-tailed p-value p_value = 2 * (1 - norm.cdf(abs(z))) print(f"Proportion A: {p_a:.3f}") print(f"Proportion B: {p_b:.3f}") print(f"z-statistic: {z:.3f}") print(f"p-value: {p_value:.4f}")
After running the z-test for proportions, you interpret the results by looking at the z-statistic and the p-value. The z-statistic quantifies how many standard errors the observed difference in proportions is away from zero (the null hypothesis). The p-value tells you the probability of observing a difference at least as extreme as the one you found, assuming there is no real difference between the groups. If this p-value is below your chosen significance threshold (commonly 0.05), you can reject the null hypothesis and conclude that there is a statistically significant difference in proportions between the two groups. If the p-value is higher, you do not have enough evidence to say the proportions are different. Always consider the context of your experiment and the practical significance of the result, not just the statistical outcome.
Obrigado pelo seu feedback!
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Awesome!
Completion rate improved to 3.23
z-test Proportions
Deslize para mostrar o menu
When comparing the proportions of a specific outcome between two groups—such as the conversion rates for two versions of a website—a z-test for proportions is a powerful tool.
A z-test for proportions helps you determine whether the difference between two observed proportions is statistically significant, or if it could have occurred by random chance.
Key applications:
- A/B testing for product or website changes;
- Clinical trials comparing treatment effects;
- Survey analysis with binary outcomes (such as success/failure or yes/no).
You should use a z-test for proportions when:
- You have large sample sizes;
- Your data represent binary outcomes.
This test is essential for making confident decisions when evaluating differences between groups.
123456789101112131415161718192021222324252627282930313233import numpy as np from scipy.stats import norm # Sample data: Group A and Group B # Let's say you run an A/B test for a new signup page. # Group A (control): 120 signups out of 600 visitors # Group B (variant): 150 signups out of 700 visitors success_a = 120 n_a = 600 success_b = 150 n_b = 700 # Calculate sample proportions p_a = success_a / n_a p_b = success_b / n_b # Pooled proportion p_pool = (success_a + success_b) / (n_a + n_b) # Standard error se = np.sqrt(p_pool * (1 - p_pool) * (1/n_a + 1/n_b)) # z-statistic z = (p_a - p_b) / se # Two-tailed p-value p_value = 2 * (1 - norm.cdf(abs(z))) print(f"Proportion A: {p_a:.3f}") print(f"Proportion B: {p_b:.3f}") print(f"z-statistic: {z:.3f}") print(f"p-value: {p_value:.4f}")
After running the z-test for proportions, you interpret the results by looking at the z-statistic and the p-value. The z-statistic quantifies how many standard errors the observed difference in proportions is away from zero (the null hypothesis). The p-value tells you the probability of observing a difference at least as extreme as the one you found, assuming there is no real difference between the groups. If this p-value is below your chosen significance threshold (commonly 0.05), you can reject the null hypothesis and conclude that there is a statistically significant difference in proportions between the two groups. If the p-value is higher, you do not have enough evidence to say the proportions are different. Always consider the context of your experiment and the practical significance of the result, not just the statistical outcome.
Obrigado pelo seu feedback!