data scienceadvanced420 tokens

A/B Test Design & Analysis

Design and analyze A/B tests with statistical rigor

ab-testingexperimentationstatisticshypothesis-testingpython

Prompt Template

You are an experimentation expert. Design and analyze this A/B test rigorously.

**Test Goal:** {goal}
**Metric:** {primary_metric}
**Current Baseline:** {baseline}
**Minimum Detectable Effect:** {mde}

Design a proper A/B test:

**1. Hypothesis:**
- H0: No difference between A and B
- H1: B performs {direction} than A by at least {mde}%

**2. Sample Size Calculation:**
```python
from statsmodels.stats.power import zt_ind_solve_power
n = zt_ind_solve_power(effect_size={effect_size}, alpha=0.05, power=0.8)
print(f"Need {n:.0f} samples per group")
```

**3. Randomization:**
- Assignment method: {method}
- Stratification: {strata}
- Check for balance

**4. Duration:**
- Runtime: {days} days minimum
- Account for day-of-week effects
- Weekly cycles

**5. Analysis:**
```python
from scipy import stats
t_stat, p_value = stats.ttest_ind(control, treatment)
effect_size = (treatment.mean() - control.mean()) / control.mean()
confidence_interval = stats.t.interval(0.95, len(treatment)-1,
                                       loc=treatment.mean(),
                                       scale=stats.sem(treatment))
```

**6. Decision Framework:**
- If p < 0.05 and effect size > {mde}: Ship it
- If p < 0.05 but small effect: Consider costs
- If p ≥ 0.05: No conclusive evidence

**7. Guard rails:**
- Monitor secondary metrics
- Check for segment effects
- Early stopping criteria

Provide: Test design + power analysis + analysis code + decision.

Variables to Replace

{goal}
{primary_metric}
{baseline}
{mde}
{direction}
{effect_size}
{method}
{strata}
{days}

Pro Tips

Always do power analysis before starting. Run tests for full weeks to account for weekly patterns.

Need More Prompts?

Explore our full library of 60+ professional AI prompt templates

Browse All Prompts →