Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

ab-testing-analyzer

FreeRuns bundled scriptsNot checked

全面的AB测试分析工具,支持实验设计、统计检验、用户分群分析和可视化报告生成。用于分析产品改版、营销活动、功能优化等AB测试结果,提供统计显著性检验和深度洞察。

liangdabiaoby liangdabiao★ 305 GitHub stars17 installs in other catalogs

About this skill

AB测试分析技能 (AB Testing Analyzer)

一个功能完整的智能AB测试分析工具,基于"数据分析咖哥十话"的AB测试模块开发。

🎯 技能概述

本技能提供从实验设计到结果分析的完整AB测试解决方案,支持多种统计检验方法、用户分群分析和可视化报告生成。

✨ 核心特性

  • 🧪 完整的AB测试流程

    • 实验设计和样本量计算
    • 随机分组验证
    • 转化率和留存率分析
    • 统计显著性检验
  • 📊 全面的统计方法

    • t检验 (独立样本、配对样本)
    • 卡方检验 (拟合优度、独立性)
    • 置信区间估计
    • 效应量计算
    • 多重比较校正
  • 👥 智能用户分群

    • 价值分群 (高/低价值客户)
    • 人口统计学分群
    • 行为模式分群
    • 自定义分群策略
    • 交互效应分析
  • 📈 丰富的可视化功能

    • 转化率对比图
    • 留存率曲线图
    • 用户分群热力图
    • 交互效应可视化
    • 统计检验结果图
  • 🔧 高级分析功能

    • 多变量AB测试
    • 贝叶斯AB测试
    • 时间序列分析
    • 稳健性检查
    • 因果推断支持

🚀 快速开始

1. 环境要求

# 依赖包
pip install pandas numpy scipy matplotlib seaborn statsmodels

2. 基础使用

from scripts.ab_test_analyzer import ABTestAnalyzer
from scripts.statistical_tests import StatisticalTests
from scripts.visualizer import ABTestVisualizer

# 初始化分析器
analyzer = ABTestAnalyzer()
stats_tests = StatisticalTests()
visualizer = ABTestVisualizer()

# 加载AB测试数据
data = analyzer.load_data('ab_test_data.csv')

# 基础转化率分析
conversion_results = analyzer.analyze_conversion(
    data,
    group_col='页面版本',
    conversion_col='是否购买'
)

# 统计显著性检验
t_test_result = stats_tests.t_test(
    data,
    group_col='页面版本',
    metric_col='是否购买'
)

# 生成可视化报告
fig = visualizer.plot_conversion_comparison(conversion_results)

3. 运行示例

# 快速测试
python quick_test.py

# 基础AB测试示例
python examples/basic_ab_test_example.py

# 高级分群分析示例
python examples/advanced_segmentation_example.py

# 综合分析示例
python examples/comprehensive_analysis_example.py

📁 项目结构

ab-testing-analyzer/
├── SKILL.md                     # 技能详细文档
├── README.md                    # 使用指南 (本文件)
├── quick_test.py               # 快速功能测试
├── test_skill.py               # 完整测试套件
│
├── scripts/                    # 核心功能模块
│   ├── __init__.py
│   ├── ab_test_analyzer.py         # AB测试核心分析
│   ├── statistical_tests.py        # 统计检验模块
│   ├── segment_analyzer.py         # 用户分群分析
│   └── visualizer.py              # 可视化生成器
│
└── examples/                   # 示例和数据
    ├── sample_data/            # 样本数据
    │   ├── sample_ab_test_data.csv
    │   └── sample_user_segments.csv
    ├── basic_ab_test_example.py     # 基础AB测试示例
    ├── advanced_segmentation_example.py # 高级分群分析示例
    └── comprehensive_analysis_example.py # 综合分析示例

💡 主要功能

1. AB测试基础分析

转化率分析

# 计算各组转化率
conversion_rates = analyzer.calculate_conversion_rates(
    data,
    group_col='实验组别',
    conversion_col='转化状态'
)

# 计算提升率和置信区间
lift_analysis = analyzer.calculate_lift(
    conversion_rates,
    control_group='对照组',
    test_group='测试组'
)

留存率分析

# 计算留存率
retention_rates = analyzer.calculate_retention_rates(
    data,
    group_col='实验组别',
    retention_col='retention_7'
)

# 留存率曲线可视化
fig = visualizer.plot_retention_curves(retention_rates)

2. 统计显著性检验

t检验

# 独立样本t检验
t_result = stats_tests.t_test(
    data,
    group_col='页面版本',
    metric_col='购买金额',
    test_type='independent'
)

# 配对样本t检验
paired_t_result = stats_tests.t_test(
    before_after_data,
    group_col='用户ID',
    metric_col='行为指标',
    test_type='paired'
)

卡方检验

# 拟合优度检验
chi2_goodness = stats_tests.chi_square_test(
    observed_data,
    expected_data,
    test_type='goodness_of_fit'
)

# 独立性检验
chi2_independence = stats_tests.chi_square_test(
    data,
    group_col='实验组别',
    outcome_col='转化状态',
    test_type='independence'
)

效应量计算

# Cohen's d计算
cohens_d = stats_tests.cohens_d(
    data,
    group_col='实验组别',
    metric_col='转化状态'
)

# Cramer's V计算
cramers_v = stats_tests.cramers_v(data, group_col, outcome_col)

3. 用户分群分析

价值分群

from scripts.segment_analyzer import SegmentAnalyzer

segment_analyzer = SegmentAnalyzer()

# 基于价值的用户分群
value_segments = segment_analyzer.value_based_segmentation(
    data,
    value_col='累计消费金额',
    n_tiers=3
)

# 分群转化率分析
segment_conversion = segment_analyzer.segment_conversion_analysis(
    data,
    segment_col='价值组别',
    group_col='实验组别',
    conversion_col='转化状态'
)

交互效应分析

# 页面版本与用户特征的交互效应
interaction_analysis = segment_analyzer.interaction_analysis(
    data,
    group_col='页面版本',
    segment_col='价值组别',
    outcome_col='转化状态'
)

# 交互效应可视化
fig = visualizer.plot_interaction_effects(interaction_analysis)

4. 高级统计分析

贝叶斯AB测试

# 贝叶斯AB测试分析
bayesian_result = analyzer.bayesian_ab_test(
    data,
    group_col='实验组别',
    conversion_col='转化状态',
    prior='jeffreys'
)

# 计算获胜概率
win_probability = analyzer.calculate_win_probability(bayesian_result)

多变量检验

# 多变量AB测试 (MVT)
mvt_result = analyzer.multivariate_test(
    data,
    group_cols=['页面版本', '按钮颜色', '标题文案'],
    conversion_col='转化状态'
)

5. 可视化报告

基础图表

# 转化率对比图
fig = visualizer.plot_conversion_comparison(
    conversion_data,
    title='AB测试转化率对比'
)

# 置信区间图
fig = visualizer.plot_confidence_intervals(
    statistical_results,
    metric='转化率'
)

# 用户分群热力图
fig = visualizer.plot_segment
Full SKILL.md on GitHub

Install ab-testing-analyzer in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

Read
Write
Bash
Glob
Grep

Bundled files

README.mdexamples/__init__.pyexamples/ab_test_analyzer.pyexamples/basic_ab_test_example.pyexamples/sample_data/sample_ab_test_data.csvexamples/segment_analyzer.pyexamples/statistical_tests.pyexamples/visualizer.pyguide/ab_test_guide.mdquick_test.pytemplates/ab_test_report_template.md

FAQ

What does the ab-testing-analyzer skill do?

全面的AB测试分析工具,支持实验设计、统计检验、用户分群分析和可视化报告生成。用于分析产品改版、营销活动、功能优化等AB测试结果,提供统计显著性检验和深度洞察。

How do I install the ab-testing-analyzer skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the ab-testing-analyzer skill run scripts?

Yes, this skill bundles executable scripts. Review the source before installing.

Related skills

Compare ab-testing-analyzer with