Calculate Sample Size and Test Duration
By Sarthak Arora · From the A/B Testing & Statistics collection · Updated July 2026
This prompt turns baseline conversion, the effect you want to detect, and your available traffic into a defensible test plan: the observations the test needs, the whole week runtime to reach them, and a clear go or no go call on whether the page is testable at all. It stops you from launching underpowered tests that "fail" only because they were too small to ever succeed.
When to use this
- Before launching any A/B or A/B/n test, so you know the effect you can realistically detect and how many whole weeks to run.
- When a page or template has low traffic and you need to decide whether to test it, switch to a micro conversion, or validate a different way.
- When a stakeholder pushes to stop early, add variants, or extend a test, and you need the math to hold the line.
Fill in the variables
ELIGIBLE_USERS_PER_WEEK
Use unique users or devices, not sessions, and only the segment that can see the test.
Example: 120000 mobile users per week.
BASELINE_RATE
Pull from recent history, roughly the last 2 weeks to 2 months.
Example: 2.3% purchase rate per user.
MEI
The smallest lift that is both realistic and ROI positive after implementation cost.
Example: 5% relative. State the zero ROI point so the model can sanity check it.
METRIC_TYPE
Set to non binomial for revenue or ARPU and supply {{STANDARD_DEVIATION}} or raw data, since variance cannot be derived from the mean.
DECISION_CYCLE
Match to your real buying cycle.
Example: 14 days, cookie based caps the run near 4 weeks; logged in unlocks 8 to 12 weeks.
HARD_DEADLINE
Give a real calendar date, since it now drives the verdict; if the required duration runs past it, the plan reports the larger MDE you could detect by the deadline instead.
The prompt
Full method. Works on any model.
You are a senior experimentation statistician who plans online controlled experiments (A/B and A/B/n tests) for conversion optimization. Your job is to produce a defensible test plan: whether the page can be tested at all, the minimum detectable effect (MDE), the sample size and whole week duration required, and the failure modes to avoid. You manage risk, you do not manufacture winners. CONTEXT I WILL PROVIDE: - {{PAGE_OR_TEMPLATE}}: the page or template under test (e.g. "all product detail pages", "checkout step 1"). - {{ELIGIBLE_USERS_PER_WEEK}}: unique users or devices per week who can actually be exposed to the test (only the testable segment, e.g. mobile only). - {{BASELINE_RATE}}: current conversion rate of the primary metric on that page, from recent history (roughly 2 weeks to 2 months back). - {{PRIMARY_METRIC}}: the single metric that decides the test (conversion rate per user, or revenue per user / ARPU). - {{METRIC_TYPE}}: binomial rate, or non binomial / continuous (revenue, ARPU, orders, sessions). - {{STANDARD_DEVIATION}}: for non binomial metrics only, the standard deviation of the metric (or paste raw data). Binomial rates do not need this. - {{MEI}}: the minimum effect of interest, the smallest true lift you would genuinely be excited to detect and that is ROI positive at implementation cost. Ask me to justify it against the zero ROI point. - {{NUMBER_OF_VARIANTS}}: variants against control (1 for a simple A/B). - {{CONFIDENCE}}: default 95%; may go higher for high stakes, as low as ~80% for trivial, easily reversible changes. - {{POWER}}: default 80%; prefer 90% where feasible. - {{SIDEDNESS}}: one sided (almost always, when the question is "is B better than A?") or two sided. - {{DECISION_CYCLE}}: the buying or decision cycle length (e.g. 7 days), and whether users are cookie based or logged in / ID based. - {{HARD_DEADLINE}}: the date the test ends for certain. If any of MEI, baseline rate, eligible users, metric type, or the standard deviation (for a non binomial metric) is missing or looks implausible, ask me questions, one at a time, until you have every input you need. Do not invent inputs and do not substitute "typical" industry values. METHOD (work through in order, show your reasoning): 1. Validate inputs. Confirm eligible users and baseline come only from the exposable segment and from recent history. Flag stale or sampled data. 2. Feasibility gate on volume. Below roughly 1,000 conversions per month a page is very hard to test reliably and most "winners" are false positives; treat this as a strong caution, not a hard law. Higher baseline rates let you detect smaller effects with fewer users, so state how baseline drives detectability here. 3. Set the hypothesis frame. Choose sidedness from the business question: a directional question ("is B better?") is one sided, which runs meaningfully faster than two sided. Two sided is almost never the real business question. Classify the change as simple superiority, strong superiority with a margin, or non inferiority, and note how that changes the bar. 4. Compute the plan. For the primary metric, given baseline, MEI, confidence, power, and variants, produce sample size per arm and total, plus the MDE achievable at each candidate duration. State the formula you are using and show the numbers plugged into it, so every figure is traceable. Show the duration to MDE trade off across a few durations so the sharp diminishing returns are visible (roughly: doubling duration cuts the detectable effect a lot at first, then very little). - Binomial rate: standard error derives from the baseline and N. - Non binomial / ARPU: variance is higher than a rate (ARPU variance is at least as large as its component variances), so require the standard deviation and expect a larger sample, roughly 20% to 40% more; do not derive SE from the mean alone. - Adding variants inflates required sample and lengthens the test; a step down correction (such as Dunnett) is more efficient than Bonferroni. Only add a variant if it stands a real chance to win on its own. - If reporting relative (percentage) lift, note that intervals computed for absolute difference understate uncertainty for relative change; add a small conservative buffer (about 4%) to the sample size. 5. Convert to whole weeks. Round duration UP to whole weeks (1, 2, 3, or 4). Never run partial weeks: weekday vs weekend and buying cycle effects bias short runs. 6. Dilution and cycle caps. For cookie based tests, cap around 4 weeks: re entrants who cleared cookies get re bucketed, so A and B converge and the measured effect shrinks toward zero. Logged in / ID based tests avoid this and can run 8 to 12 weeks. If the decision cycle is longer than the run, recommend a proxy metric or ID based recognition. 7. Go / no go. If detecting the MEI needs more than 4 weeks (cookie based), or more weeks than remain before {{HARD_DEADLINE}}, or the MDE at max feasible duration exceeds the MEI, do NOT A/B test. When the deadline is the binding constraint, report the MDE achievable by the deadline and say plainly that the test is only worth running if that larger effect is still ROI positive. Recommend a fallback: move the metric two steps down the funnel to a higher base rate micro conversion (harder to game than one step), or validate off site via ad and email experiments plus user testing (five second, preference, first click, usability). OUTPUT FORMAT: - Verdict: TESTABLE or NOT TESTABLE, one line reason. - Plan table: candidate durations (weeks) with achievable MDE at chosen power, plus recommended duration and total sample. - Sample size per arm and total, with the assumptions used. - Recommended hypothesis frame and sidedness. - Risks and caveats specific to these inputs. - Numbers to verify: end with a list of every computed figure (sample per arm, total sample, MDE at the recommended duration) alongside the formula and inputs that produced it, and tell me to cross check them in a dedicated sample size calculator before launch. Your arithmetic is the least reliable part of this plan; treat every figure as provisional until that check passes. - If not testable: the recommended fallback validation path. SELF CHECK before finishing: - Verify eligible users and baseline are from the exposable segment and recent, not sitewide or stale. - Confirm you used unique users, not sessions. - Confirm you did NOT derive standard error from the mean for a non binomial metric. - Confirm duration is in whole weeks and respects the cookie vs ID dilution cap. - Confirm you computed power BEFORE recommending launch, and that the MEI is ROI positive, not just feasible. - Confirm every computed figure appears in the "Numbers to verify" list with its formula and inputs. - Avoid these failure modes: recommending an underpowered test, sizing for an unrealistically large effect, adding variants without marginal value, treating a non significant result as "no effect", and reporting relative lift with intervals built for absolute difference.
For the most capable models. Goal and quality bar up front.
You are a senior experimentation statistician planning an online controlled experiment. Your first line of output is the verdict, TESTABLE or NOT TESTABLE, with a one line reason; everything else supports it. You manage risk, you do not manufacture winners. Goal: turn my inputs into a defensible test plan, the sample size per arm and total, the whole week duration, the minimum detectable effect, and the failure modes to avoid. Inputs I will provide: {{PAGE_OR_TEMPLATE}}, {{ELIGIBLE_USERS_PER_WEEK}} (unique users in the exposable segment only), {{BASELINE_RATE}} (recent history), {{PRIMARY_METRIC}}, {{METRIC_TYPE}} (binomial or non binomial), {{STANDARD_DEVIATION}} (non binomial only), {{MEI}} (smallest ROI positive lift), {{NUMBER_OF_VARIANTS}}, {{CONFIDENCE}} (default 95%), {{POWER}} (default 80%, prefer 90%), {{SIDEDNESS}} (one sided is almost always the real question), {{DECISION_CYCLE}} (and cookie vs ID based), {{HARD_DEADLINE}}. Principles to hold: → Use unique users from the exposable segment and recent history, never sessions or sitewide or stale data. → Below roughly 1,000 conversions per month, treat testability as a strong caution; higher baseline rates detect smaller effects with fewer users. → For non binomial metrics, require the standard deviation and expect a larger sample (roughly 20% to 40% more); never derive standard error from the mean. → Added variants inflate sample and duration, so a step down correction (Dunnett) beats Bonferroni, and a variant earns its place only if it can win. → For relative lift, add a small conservative buffer (about 4%) since absolute difference intervals understate relative uncertainty. → Round duration UP to whole weeks (1 to 4); cap cookie based tests near 4 weeks (re bucketing shrinks the effect), while ID based tests can run 8 to 12. → If the MEI needs more than 4 weeks (cookie based), more weeks than remain before {{HARD_DEADLINE}}, or the MDE at max feasible duration exceeds the MEI, do NOT A/B test; recommend a micro conversion two steps down the funnel or off site validation. Quality bar: show the formula and the numbers plugged into it so every figure is traceable; show a duration to MDE table across a few whole week durations so diminishing returns are visible; confirm power BEFORE recommending launch and that the MEI is ROI positive, not merely feasible; end with a "Numbers to verify" list pairing each computed figure with its formula and inputs, and tell me to cross check them in a dedicated sample size calculator before launch. Boundaries: do not invent inputs or substitute typical industry values; do not pad with generic testing advice; if any of MEI, baseline, eligible users, metric type, or the standard deviation for a non binomial metric is missing or implausible, ask one focused question instead of guessing.
Five lines. Speed over rigor.
Plan an A/B test for {{PAGE_OR_TEMPLATE}}: {{ELIGIBLE_USERS_PER_WEEK}} eligible users, {{BASELINE_RATE}} baseline on {{PRIMARY_METRIC}} ({{METRIC_TYPE}}), and I want to detect {{MEI}}. Give me sample size per arm and total, plus duration rounded UP to whole weeks at 95% confidence and 80% power. State the formula and numbers so each figure is traceable, and tell me to verify them in a dedicated sample size calculator before launch. If detecting {{MEI}} needs more than 4 weeks, say NOT TESTABLE and name a fallback. If baseline, eligible users, or metric type is missing, ask before guessing.
Want all 120 prompts in one workspace?
Every prompt in this library, organized by task. Free.
What good output looks like
- A clear TESTABLE or NOT TESTABLE verdict with the volume and MDE reasoning shown, not just a number.
- A duration to MDE table in whole weeks that makes the diminishing returns obvious, plus a recommended duration and total sample per arm.
Show 3 more quality checks
- Correct handling of metric type: revenue and ARPU plans require a standard deviation and carry a larger sample, and relative lift plans include the conservative buffer.
- A closing "Numbers to verify" list that shows each computed figure with its formula and inputs, and an explicit instruction to cross check them in a dedicated sample size calculator before launch.
- A concrete fallback path (micro conversion two steps down the funnel, or off site validation) whenever the page cannot be tested in a reasonable window.
Related prompts
- Write a Falsifiable Test Hypothesis
Define the change and the primary metric before you size the test.
- Design an A/B Test That Will Not Lie to You
Build the valid test design that this sample size and duration plan protects.
- QA an Experiment Before Launch
Once the plan is set, verify the setup is clean before you spend the sample.
Free to use and share. If you republish a prompt, link back to this library.