You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Python评估A/B测试结果及相关假设检验问题

Hey folks, let's walk through how to work with conversion rate calculations and hypothesis testing for your A/B test results—now that you've collected data on user conversions for both site variants.

A/B测试:转化率计算与假设检验

转化率计算公式

First, let's define our terms clearly:

  • Control group: Total users = c_t, Converted users = c_n
  • Variant group: Total users = v_t, Converted users = v_n

The conversion rates for each group are calculated as:
$$
\mathrm{CR}_c = \frac{c_n}{c_t} \quad \mathrm{CR}_v = \frac{v_n}{v_t}
$$

常见的假设检验类型

Depending on what you're trying to prove, you'll choose one of these null hypothesis frameworks:

双侧检验

This is for when you want to check if there's any significant difference between the two groups (no matter which performs better):

  • Null hypothesis: $H_0: \mathrm{CR}_c = \mathrm{CR}_v$
  • Alternative hypothesis: $H_a: \mathrm{CR}_c \neq \mathrm{CR}_v$

单侧检验(检验控制组是否更优)

The original text cuts off here, but this is the standard complementary setup for the given null hypothesis:

  • Null hypothesis: $H_0: \mathrm{CR}_c > \mathrm{CR}_v$
  • Typical alternative hypothesis (to complete the test): $H_a: \mathrm{CR}_c \leq \mathrm{CR}_v$

单侧检验(检验变体组是否更优)

Another common directional test focuses on whether the variant outperforms the control:

  • Null hypothesis: $H_0: \mathrm{CR}_c \geq \mathrm{CR}_v$
  • Alternative hypothesis: $H_a: \mathrm{CR}_c < \mathrm{CR}_v$

Once you've selected the right test, you can use methods like the z-test or chi-squared test to compute the p-value and decide whether to reject the null hypothesis based on your chosen significance level (usually $\alpha = 0.05$).

内容的提问来源于stack exchange,提问作者Dror Atariah

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:06:14