Loading, please wait...

BAD702 Program 6

6. A company is testing two versions of a webpage (A and B) to determine which version leads to more sales. Version A was 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.

PROGRAM:

import numpy as np
from statsmodels.stats.proportion import proportions_ztest

# Given data
successes = np.array([120, 150])  # number of sales for A and B
n = np.array([1000, 1200])        # number of users for A and B
alpha = 0.05                       # significance level

# Perform two-proportion z-test
z_stat, p_value = proportions_ztest(successes, n)

# Print results
print(f"Z-statistic: {z_stat:.3f}")
print(f"P-value: {p_value:.5f}")

# Conclusion
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.")

OUTPUT:

Z-statistic: -0.356
P-value: 0.72193
Fail to reject the null hypothesis: No significant difference in conversion rates between A and B.
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x