Skip to content

Power and sample size

stats_power_sample_size

Works out the power for a given n per group, or the smallest n per group that reaches a target power.

Runs
Built, not hosted
Level
Checked against a reference: R 4.4.3 power.t.test, power.anova.test and power.prop.test

What it is

Required: test (two-sample, paired, one-sample, anova, proportions); solveFor (power, n); alpha (0.01, 0.05, 0.1). Plans a study: statistical power at n per group, or smallest integer n per group reaching target power (never a bare ceiling), for two-sided t tests, one-way ANOVA (planned group means), or two proportions. Returns the matching R call. Invalid inputs, zero effects, or unreachable power are withheld with their codes, and a power that cannot be computed as a number is withheld as POWER_UNRESOLVED.

Field: Statistics. It is the same calculation as Drybench Assay, called by an AI assistant through the server.

What it does

You give

  • test (required): Planned analysis: 'two-sample', 'paired', 'one-sample', 'anova', or 'proportions'.
  • solveFor (required): 'power' for power at n per group, or 'n' for smallest integer n per group reaching target.
  • alpha (required): Two-sided significance level: 0.01, 0.05, or 0.1.
  • n: Required when solveFor is 'power': planned sample size per group (pairs for paired).
  • target: Required when solveFor is 'n': target power (0.8, 0.85, 0.9, or 0.95).
  • delta: t tests: difference to detect in measurement unit (paired: mean difference).

and 4 more, listed below

A request and its answer

Asked with

test
two-sample
solveFor
n
target
0.8
alpha
0.05
delta
1
sd
1.2

It answered (computed)

test
two-sample
solveFor
n

Computed by this tool when the page was built. The steps between are not recorded, so this is not a worked example. The reply carries more values than are shown here.

Limits

  • Every computed number a reply returns, other than an integer or an exact decimal, is rounded once to 12 significant figures: to the nearest, a change of at most 5 × 10⁻¹² of its value, except that a lower bound is rounded down and an upper bound up, a change of less than 1 × 10⁻¹¹; the method computes, and decides any pass or fail, on the unrounded value.
  • No other limit is recorded for this tool.
Every input, with its units10 inputs
  • test (required): Planned analysis: 'two-sample', 'paired', 'one-sample', 'anova', or 'proportions'.
  • solveFor (required): 'power' for power at n per group, or 'n' for smallest integer n per group reaching target.
  • alpha (required): Two-sided significance level: 0.01, 0.05, or 0.1.
  • n: Required when solveFor is 'power': planned sample size per group (pairs for paired).
  • target: Required when solveFor is 'n': target power (0.8, 0.85, 0.9, or 0.95).
  • delta: t tests: difference to detect in measurement unit (paired: mean difference).
  • sd: t tests and ANOVA: assumed positive standard deviation in measurement unit.
  • means: ANOVA: planned group means (2 to 10 groups) in measurement unit.
  • p1: Proportions: first group proportion strictly in (0, 1).
  • p2: Proportions: second group proportion strictly in (0, 1).

The calculation

The method's equations, constants and worked example.

Power and sample size for t-tests, one-way ANOVA and two proportions (two-sided)power-sample-size@1.0.2

No equation is recorded for this version.

Kind of method: not recorded.

Worked example: not recorded for power-sample-size@1.0.2.

Sources

No source is recorded for this tool's methods.

How it is checked

Level

Checked against a reference.

Checked against

R 4.4.3 power.t.test, power.anova.test and power.prop.test (strict = FALSE; n solved at tolerance 1e-10) on 26 cases: power within 1e-8 (t, proportions) and 1e-7 (ANOVA), computed n within 1e-6 relative, the smallest integer n, flags and withheld states exact; SciPy nct, ncf and norm agree on all 19 cases with a number (2026-10-13).

Cases

No case set is linked to this version.

Hostile inputs

Sent 67 malformed, extreme and misspelt calls. None broke it, and every call with an undeclared argument, or with text in place of a number or a true/false value, was declined with a reason.

Run 2026-11-12-2 of 12 November 2026, server 0.11.0.

Same answer

Called twice and with its arguments in another order, it gave the same result.

Run 2026-11-12-2 of 12 November 2026, server 0.11.0.

Not checked

Not recorded. Its absence does not mean everything was checked.

What this project's records still lack5 things
  • A case worked by hand from the source's equation for power-sample-size@1.0.2.
  • The equation for power-sample-size@1.0.2.
  • The constants with their sources for power-sample-size@1.0.2.
  • A case set linked to this version for power-sample-size@1.0.2.
  • A record of what was not checked for power-sample-size@1.0.2.
Cite a number from this toolthe cite line

Every reply carries a cite line naming the tool, the server version, each method with its version and level, and the receipt. Quote it with any number taken from the reply.

stats_power_sample_size, server 1.0.0; power-sample-size@1.0.2 (Checked against a reference); receipt d81886e8239f/713dfa4aa981; methods https://www.drybench.com/methods/assay; page https://www.drybench.com/methods/tools/stats-power-sample-size. Quote this line with any number taken from this reply.
Changes to its methods1 change
  • 21 November 2026, power-sample-size@1.0.2: In 1.0.2 the normal distribution function is finite at every argument: where the incomplete gamma's leading factor e^−x x^a/Γ(a) rounds to 0 its value is 0 (the fraction is at most 1/(x−a+1) for a ≥ 1 (8.2.2), at most 1/x for a ≤ 1 (8.10.1); below 1 in both), so Φ(−z) is 0 and Φ(z) is 1 from |z| of about 38.6, and beyond z² overflow they are their limits (DLMF 7.11.2 and 7.8.2). Those designs are now answered: delta 1e200 with sd 1 gives three per group, total 6, power 1. POWER_UNRESOLVED stays for a power that is not a number. No value of the distribution function that was a number moved, on 1,200,000 seeded points in its normal range.