Design rigorous A/B tests with proper sample size calculations, hypothesis formulation, and statistical analysis plans.
You are a statistician designing an A/B test for a product team. Based on the following experiment context, create a complete test design and analysis plan. Experiment Goal: [WHAT YOU WANT TO IMPROVE - e.g., conversion rate, revenue per user, engagement] Primary Metric: [THE MAIN KPI YOU ARE MEASURING] Baseline Value: [CURRENT VALUE OF THE PRIMARY METRIC] Minimum Detectable Effect: [SMALLEST MEANINGFUL IMPROVEMENT - e.g., 5% relative lift] Traffic Volume: [DAILY USERS OR EVENTS AVAILABLE FOR THE TEST] Business Context: [WHY THIS TEST MATTERS AND WHAT WILL CHANGE BASED ON RESULTS] Create the test design across these six sections: 1. HYPOTHESIS FORMULATION AND TEST FRAMEWORK Formulate the null and alternative hypotheses in both statistical and business language. Determine whether a one-tailed or two-tailed test is appropriate and justify the choice. Define the primary metric precisely including its unit of analysis, measurement window, and any exclusion criteria. Identify secondary and guardrail metrics that should be monitored alongside the primary metric. Explain the difference between practical significance and statistical significance in the context of this specific experiment and establish thresholds for both. 2. SAMPLE SIZE AND DURATION CALCULATION Calculate the required sample size per variant using the specified baseline, minimum detectable effect, significance level of 0.05, and power of 0.80. Show the calculation step by step using both the formula approach and Python code with statsmodels. Translate the sample size into expected test duration based on available traffic. Address the impact of changing power or significance level on duration. If the required duration is impractically long, suggest alternatives such as increasing the minimum detectable effect, using more sensitive metrics, or employing variance reduction techniques like CUPED. 3. RANDOMIZATION AND SEGMENTATION DESIGN Design the randomization strategy including the unit of randomization, hashing method, and how to ensure balanced groups. Address common pitfalls such as network effects, session-based versus user-based randomization, and new versus returning user handling. Define any pre-stratification groups to ensure balance on important covariates. Explain how to implement holdout groups and how to verify randomization quality using balance checks including chi-square tests on categorical variables and t-tests on continuous variables. 4. STATISTICAL ANALYSIS PLAN Write the complete statistical analysis plan that will be executed at the conclusion of the test. For the primary metric, specify the exact test to use such as z-test for proportions, t-test for means, or Mann-Whitney for non-normal distributions. Provide Python code using scipy.stats and statsmodels for running the analysis. Cover confidence interval calculation, effect size estimation with Cohens d or relative lift, and multiple comparison corrections if testing more than two variants. Include a sequential testing option using group sequential methods if early stopping is desired. 5. VALIDITY THREATS AND MITIGATION Identify potential threats to the experiment including novelty effects, selection bias, survivorship bias, instrumentation errors, and interference between variants. For each threat, explain how to detect it and what mitigation strategies to employ. Cover the peeking problem and how it inflates false positive rates. Explain Simpson paradox and how to check for it across segments. Provide a pre-experiment checklist including AA test verification, logging validation, and metric definition review. 6. RESULTS INTERPRETATION AND DECISION FRAMEWORK Create a decision framework for acting on the results. Cover the four possible outcomes: statistically significant positive result, statistically significant negative result, inconclusive result, and practically insignificant but statistically significant result. For each scenario, provide guidance on the appropriate business action. Include a results reporting template with visualizations such as confidence interval plots and cumulative metric charts. Address how to handle surprising or counterintuitive results and when to recommend follow-up experiments.
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[THE MAIN KPI YOU ARE MEASURING][CURRENT VALUE OF THE PRIMARY METRIC][DAILY USERS OR EVENTS AVAILABLE FOR THE TEST][WHY THIS TEST MATTERS AND WHAT WILL CHANGE BASED ON RESULTS]