Power and sample size
How many parts to measure: power and sample size for t-tests, proportions and one-way ANOVA, and the sample size of a capability study for a Cpk confidence bound.
1-sample t · input
Runs in this browser. Data is not uploaded or stored.
1-sample t · results
n = 23 to 36
With n = 23 values, a difference of the mean from the target of 0.5 is detected with power 0.817 (target 0.8); with one less the power falls short. The table has all 3 combinations.
H₀: μ = μ₀, H₁: μ ≠ μ₀; difference = μ − μ₀; two-sided, α = 0.05; σ = 0.8; exact power from the noncentral t distribution, n − 1 degrees of freedom.
- σ is a planning value: take it from earlier data of the same process (a capability study or a control chart); a σ that is too small gives too few samples.
| Difference | Target power | Sample size | Actual power |
|---|---|---|---|
| 0.5 | 0.8 | 23 | 0.817107 |
| 0.5 | 0.9 | 29 | 0.901175 |
| 0.5 | 0.95 | 36 | 0.954034 |
2-sample t · input
Runs in this browser. Data is not uploaded or stored.
2-sample t · results
n = 26 to 34 per sample
With n = 26 per sample, a difference between the means of 0.04 is detected with power 0.807 (target 0.8); with one less the power falls short. The table has all 2 combinations.
H₀: μ₁ = μ₂, H₁: μ₁ ≠ μ₂; difference = μ₁ − μ₂; two-sided, α = 0.05; σ = 0.05 in both samples; exact power from the noncentral t distribution, equal σ, 2n − 2 degrees of freedom.
- σ is a planning value: take it from earlier data of the same process (a capability study or a control chart); a σ that is too small gives too few samples.
| Difference | Target power | Sample size per sample | Actual power |
|---|---|---|---|
| 0.04 | 0.8 | 26 | 0.807487 |
| 0.04 | 0.9 | 34 | 0.901502 |
Paired t · input
Runs in this browser. Data is not uploaded or stored.
Paired t · results
Power = 0.651 to 0.942
With n = 10 pairs, a mean paired difference of 1 is detected with power 0.651: about 35 of 100 such studies would miss it. The table has all 3 combinations.
H₀: μ_d = 0, H₁: μ_d ≠ 0; difference = mean of First − Second; two-sided, α = 0.05; σ of the differences = 1.2; exact power from the noncentral t distribution, n − 1 degrees of freedom.
- σ is a planning value: take it from earlier data of the same process (a capability study or a control chart); a σ that is too small gives too few samples.
| Difference | Pairs | Power |
|---|---|---|
| 1 | 10 | 0.651227 |
| 1 | 15 | 0.850777 |
| 1 | 20 | 0.942102 |
1 proportion · input
Runs in this browser. Data is not uploaded or stored.
1 proportion · results
n = 253 to 322
With n = 253 items, a true proportion of 0.02 is detected with power 0.802 (target 0.8); with one less the power falls short. The table has all 2 combinations.
H₀: p = 0.05, H₁: p < 0.05; one-sided (<), α = 0.05; hypothesized p₀ = 0.05; normal approximation as Minitab (σ₀ from p₀, σ₁ from the comparison p).
- Normal approximation, as Minitab’s Power and Sample Size: the exact binomial test has a saw-tooth power that can be a little lower or higher at a given n.
| Comparison p | Target power | Sample size | Actual power |
|---|---|---|---|
| 0.02 | 0.8 | 253 | 0.801725 |
| 0.02 | 0.9 | 322 | 0.900533 |
2 proportions · input
Runs in this browser. Data is not uploaded or stored.
2 proportions · results
n = 749 to 1002 per sample
With n = 749 per sample, a comparison proportion p₁ of 0.03 is detected with power 0.8 (target 0.8); with one less the power falls short. The table has all 2 combinations.
H₀: p₁ = p₂, H₁: p₁ ≠ p₂ (p₁ comparison, p₂ baseline); two-sided, α = 0.05; baseline p₂ = 0.06; normal approximation as Minitab (σ₀ from the pooled (p₁ + p₂)/2, σ₁ from p₁ and p₂).
- Normal approximation, as Minitab’s Power and Sample Size: the exact binomial test has a saw-tooth power that can be a little lower or higher at a given n.
| Comparison p | Target power | Sample size per sample | Actual power |
|---|---|---|---|
| 0.03 | 0.8 | 749 | 0.800322 |
| 0.03 | 0.9 | 1002 | 0.900176 |
One-way ANOVA · input
Runs in this browser. Data is not uploaded or stored.
One-way ANOVA · results
Maximum difference = 2.136 to 4.046
With n = 5 per level and power 0.9, the smallest effect detected is a maximum difference between the means of 4.04637. The table has all 3 combinations.
H₀: all means equal, H₁: not all equal; α = 0.05; 4 levels, σ = 1.5; exact power from the noncentral F distribution, λ = n Δ² / (2σ²).
- σ is a planning value: take it from earlier data of the same process (a capability study or a control chart); a σ that is too small gives too few samples.
| Sample size per level | Power | Maximum difference |
|---|---|---|
| 5 | 0.9 | 4.04637 |
| 10 | 0.9 | 2.66762 |
| 15 | 0.9 | 2.1356 |
Capability study · input
Runs in this browser. Data is not uploaded or stored.
Capability study · results
n = 37
Measure 37 parts: if the study then gives Cpk = 1.67, its 95% lower bound is 1.334, so Cpk ≥ 1.33 is shown with 95% confidence.
Cpk (also Ppk), 95% lower confidence bound; Bissell’s approximation Ĉ ± z √(1/(9n) + Ĉ²/(2(n − 1))), as the Cpk tool; n individual values, σ with n − 1 degrees of freedom.
- Assumes n individual values from a stable, normal process and σ estimated with n − 1 degrees of freedom (overall σ: Ppk, Pp; or Cpk, Cp from one column with the moving-range σ, as the Cpk tool counts it). With subgroups the within σ has fewer degrees of freedom, ν = Σ(nᵢ − 1) (25 subgroups of 5: N = 125, ν = 100), so the Cpk interval is a little wider than this table shows for the same N.
- The interval is the one the analysis reports when the estimate comes out exactly at the planned Cpk. The estimate itself varies from study to study: about half of the studies of a process with exactly the planned Cpk give a lower estimate (and a lower bound below the requirement). Plan with a margin.
| Planned Cpk | Sample size | Required lower bound | Lower bound | Planned − lower |
|---|---|---|---|---|
| 1.67 | 37 | 1.33 | 1.33396 | 0.336041 |
| Sample size | Lower bound | Planned − lower | Row |
|---|---|---|---|
| 30 | 1.29568 | 0.37432 | |
| 37 | 1.33396 | 0.336041 | found |
| 50 | 1.38189 | 0.28811 | |
| 100 | 1.46723 | 0.202768 | |
| 125 | 1.48881 | 0.181191 | |
| 200 | 1.52696 | 0.143044 |
Download offline versionSingle HTML file · v1.3 · 308 KB · works without internet
Method
- Seven calculators on one page: the “Calculator” switch shows one of them. Each keeps its own fields and results; the settings file saves all of them and the chosen one. These are field calculators: there is no data to paste, so file import does not apply here (the analysis tools take the data afterwards). Exports are the results CSV and the settings JSON.
- Specify any two (as Minitab’s Power and Sample Size): of sample sizes, differences (or proportions) and power values, fill in two and leave the third empty; it is calculated for every combination of the others (up to 10 values per field, separated by spaces or semicolons, since a comma can be a decimal sign). A sample size is the smallest whole number whose power reaches the target; its actual power is shown too, as Minitab does. A difference is solved to full precision. A decimal comma in the fields gives decimal commas in the results and “;” in the CSV.
- Power is the probability that the test finds the difference when it is really there. 0.8 is a common minimum, 0.9 a safer choice. Power equals α when there is no difference; a sample size can therefore never be found for a difference of 0 or one in the direction the alternative excludes (the table says so).
- 1-sample t and paired t: exact power from the noncentral t distribution with n − 1 degrees of freedom and noncentrality δ = d √n / σ. Two-sided: P(T > t₁₋α/₂) + P(T < −t₁₋α/₂); “>”: P(T > t₁₋α); “<”: P(T < −t₁₋α). The paired t is the 1-sample t on the differences First − Second, so σ is the standard deviation of the differences (usually much smaller than that of the values when the pairing removes part-to-part variation).
- 2-sample t: n in each sample and the same σ in both (Minitab’s assumption for planning); 2n − 2 degrees of freedom, δ = d / (σ √(2/n)). Unequal σ or sample sizes are not offered.
- Noncentral t and F are written here without libraries: Poisson mixtures of incomplete beta functions, summed from the largest term outwards (Guenther 1978; Lenth’s AS 243 with the improvement of Benton & Krishnamoorthy 2003). They match scipy.stats.nct and scipy.stats.ncf to 1e-9 relative (1e-12 absolute) at several hundred points.
- 1 proportion (Minitab’s formula, normal approximation): with σ₀ = √(p₀(1 − p₀)/n) and σ₁ = √(p(1 − p)/n), power = Φ((p − p₀ − z₁₋α σ₀)/σ₁) for “>”, Φ((p₀ − p − z₁₋α σ₀)/σ₁) for “<”, and the sum of both with z₁₋α/₂ for ≠. This reproduces Minitab’s published example to every printed digit (p₀ 0.065: 0.431131, 0.764259, 0.449114, 0.703796). It is not the power of the exact binomial test, whose power jumps up and down with n (a “saw tooth”): for the same example the equal-tailed exact test (at most α/2 in each tail) gives 0.427, 0.758, 0.367, 0.649 and the arcsine approximation (statsmodels) 0.504, 0.795, 0.398, 0.672. When n · p is below 5 the page warns that the approximation is rough.
- 2 proportions (Minitab’s formula): n in each sample, σ₀ = √(2 p̄(1 − p̄)/n) with p̄ = (p₁ + p₂)/2, σ₁ = √((p₁(1 − p₁) + p₂(1 − p₂))/n), the same power formula with p₁ − p₂. Solving for the comparison proportion gives the value above and the one below the baseline for ≠ (Minitab’s example, baseline 0.6, n 1000, power 0.9: 0.669724 and 0.528190, reproduced here).
- One-way ANOVA: k levels with n values each; power from the noncentral F distribution with k − 1 and k(n − 1) degrees of freedom and λ = n Δ² / (2σ²), Δ the maximum difference between two means. This λ belongs to the least favourable means with that range (two means Δ apart, the others midway), so the power is the least the design gives, as Minitab defines it (its example, k 4, σ 1.64, power 0.9: Δ = 4.42404, 3.58435, 3.09574 for n = 5, 7, 9).
- Power curve: power against the difference (or the comparison proportion), one line per sample size of the table (at most six; the lines differ by dash pattern), with the table values as circles and the line of no difference, where the power equals α.
- Capability study: how many values a Cpk / Ppk or Cp / Pp study needs. The interval is the one the analysis would report when the estimate comes out exactly at the planned index. Cpk and Ppk: Bissell’s approximation Ĉ ± z √(1/(9n) + Ĉ²/(2(n − 1))), the formula of the Cpk tool (shared code); Cp and Pp: the exact chi-square interval Ĉ √(χ²_(α/2; n−1)/(n − 1)) to Ĉ √(χ²_(1−α/2; n−1)/(n − 1)). A lower bound uses z₁₋α or χ²_(α) (one-sided). Example: to show Cpk ≥ 1.33 with 95% confidence when the process runs at Cpk 1.67, 37 values are needed (lower bound 1.334); a ±0.1 interval for Cpk 1.33 takes 384 values. Solving for the planned index gives the estimate a study of n values must reach.
- Effective n in a capability study: the table assumes n individual values and σ with n − 1 degrees of freedom: the overall σ (Ppk, Pp), or the Cpk from one column, whose moving-range σ the Cpk tool counts with N − 1 moving ranges. With subgroups the within σ has ν = Σ(nᵢ − 1) degrees of freedom (25 subgroups of 5: N = 125, ν = 100) and the Cpk interval is somewhat wider for the same N. Values that are not independent (taken minutes apart from a drifting process) carry less information than their number suggests. And since the estimate varies from study to study, a process exactly at the planned Cpk misses the requirement in about half of the studies: plan with a margin.
- Checks: every result is compared with an independent Python script (scipy.stats nct, ncf, t, f, norm and chi2, sample sizes by a plain upward scan, differences by brentq), which also checks itself against statsmodels’ TTestPower, TTestIndPower and FTestAnovaPower, for 21 power cases (all three solve modes, one- and two-sided, other α) and 10 capability cases. Minitab’s published examples (1-sample t: n 26, power 0.904254; 2-sample t: n 86, power 0.903230; 1 proportion, 2 proportions and one-way ANOVA as above) and the textbook values (2-sample t, d/σ = 1, power 0.8: 17 per group; 1-sample t, d/σ = 0.5: 34) are reproduced.
- Examples: illustrative planning values, not data from a real plant: a fill weight against its target, wall thickness of two suppliers, boards in two fixtures, a defective rate before and after, two lines, four machines and a Cpk study. Exports mark a calculator as an example while its fields are unchanged.