6

import statsmodels.api as sm

x1=120

n1=1000

x2=150

n2=1200

count=[x1, x2]

nobs=[n1, n2]

z_stat,p_value=sm.stats.proportions_ztest(count, nobs)

print(f"Z-statistic: {z_stat:.4f}")

print(f"P-value: {p_value:.4f}")

if p_value<0.05:

    print("Result: Reject the null hypothesis. There is a statistically significant difference in conversion rates.")

else:

    print("Result: Fail to reject the null hypothesis. No significant difference in conversion rates.")


Comments