SMLDS_LAB

Exp 6: A company is testing two versions of a webpage (A and B) to determine which version leads to more sales. Version Awas shown to 1,000 users and resulted in 120 sales. Version B was shown to 1,200 users and resulted in 150 sales. Perform an A/B test to determine if there is a statistically significant difference in the conversion rates between the two versions. Use a 5% significance level.

import numpy as np
from statsmodels.stats.proportion import proportions_ztest
successes = np.array([120, 150]) 
n = np.array([1000, 1200])
alpha = 0.05 
z_stat, p_value = proportions_ztest(successes, n)
print(f"Z-statistic: {z_stat:.3f}")
print(f"P-value: {p_value:.5f}")
if p_value < alpha:
 print("Reject the null hypothesis: There is a significant difference in conversion rates between A and B.")
else:
 print("Fail to reject the null hypothesis: No significant difference in conversion rates between A and B.")
Z-statistic: -0.356
P-value: 0.72193
Fail to reject the null hypothesis: No significant difference in conversion rates between A and B.

alt text