Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Sample size calculation and statistical power analysis guide
.claude/skills/brycewang-stanford-power-analysis-guide/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-13 | ✗→✓ | ▲ Improved | 36% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 103% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 65% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 16% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 110% | 0% |
Calculate appropriate sample sizes for your study using power analysis, understand effect sizes, and avoid underpowered or wastefully overpowered designs.
Every power analysis involves four interrelated quantities. Fix any three to solve for the fourth:
| Parameter | Symbol | Definition | Typical Value | |-----------|--------|-----------|---------------| | Effect size | d, r, f, etc. | Magnitude of the phenomenon you expect to detect | Varies by field | | Significance level (alpha) | alpha | Probability of Type I error (false positive) | 0.05 | | Statistical power (1 - beta) | 1 - beta | Probability of detecting a true effect | 0.80 or 0.90 | | Sample size | N | Number of observations needed | Solve for this |
| | H0 is true (no effect) | H0 is false (effect exists) | |---|---|---| | Reject H0 | Type I error (alpha) | Correct (power = 1 - beta) | | Fail to reject H0 | Correct (1 - alpha) | Type II error (beta) |
d = (M1 - M2) / SD_pooled| Size | Cohen's d | Interpretation | |------|-----------|---------------| | Small | 0.2 | Subtle, may need large N to detect | | Medium | 0.5 | Noticeable, typical in social sciences | | Large | 0.8 | Obvious, often visible without statistics |
| Size | r | r-squared | |------|---|-----------| | Small | 0.1 | 1% variance explained | | Medium | 0.3 | 9% variance explained | | Large | 0.5 | 25% variance explained |
| Size | f | Equivalent eta-squared | |------|---|----------------------| | Small | 0.10 | 0.01 | | Medium | 0.25 | 0.06 | | Large | 0.40 | 0.14 |
| Size | OR | |------|-----| | Small | 1.5 | | Medium | 2.5 | | Large | 4.0 |
pythonfrom statsmodels.stats.power import TTestIndPower analysis = TTestIndPower() # Solve for sample size n = analysis.solve_power( effect_size=0.5, # Cohen's d = medium alpha=0.05, # Significance level power=0.80, # 80% power ratio=1.0, # Equal group sizes alternative='two-sided' ) print(f"Required N per group: {int(n) + 1}") # Output: 64 # Solve for power (given N) power = analysis.solve_power( effect_size=0.5, alpha=0.05, nobs1=50, ratio=1.0, alternative='two-sided' ) print(f"Power with N=50 per group: {power:.3f}") # Output: 0.697
pythonfrom statsmodels.stats.power import TTestPower analysis = TTestPower() n = analysis.solve_power( effect_size=0.3, # Small-medium effect alpha=0.05, power=0.80, alternative='two-sided' ) print(f"Required N (paired): {int(n) + 1}") # Output: 90
pythonfrom statsmodels.stats.power import FTestAnovaPower analysis = FTestAnovaPower() n = analysis.solve_power( effect_size=0.25, # Cohen's f = medium alpha=0.05, power=0.80, k_groups=4 # Number of groups ) print(f"Required N per group: {int(n) + 1}") # Output: 45
pythonfrom statsmodels.stats.power import GofChisquarePower analysis = GofChisquarePower() n = analysis.solve_power( effect_size=0.3, # Cohen's w = medium alpha=0.05, power=0.80, n_bins=4 # Degrees of freedom + 1 ) print(f"Required total N: {int(n) + 1}")
pythonfrom statsmodels.stats.power import FTestPower analysis = FTestPower() # For R-squared: convert to f2 = R2 / (1 - R2) r_squared = 0.10 # Expected R-squared for the model f2 = r_squared / (1 - r_squared) # f2 = 0.111 n = analysis.solve_power( effect_size=f2, alpha=0.05, power=0.80, df_num=5 # Number of predictors ) # n returned is df_denom; total N = n + df_num + 1 total_n = int(n) + 5 + 1 print(f"Required total N: {total_n}")
rlibrary(pwr) # Two-sample t-test result <- pwr.t.test(d = 0.5, sig.level = 0.05, power = 0.80, type = "two.sample", alternative = "two.sided") cat("N per group:", ceiling(result$n), "\n") # Correlation test result <- pwr.r.test(r = 0.3, sig.level = 0.05, power = 0.80, alternative = "two.sided") cat("Total N:", ceiling(result$n), "\n") # One-way ANOVA (4 groups) result <- pwr.anova.test(k = 4, f = 0.25, sig.level = 0.05, power = 0.80) cat("N per group:", ceiling(result$n), "\n") # Chi-square test result <- pwr.chisq.test(w = 0.3, df = 3, sig.level = 0.05, power = 0.80) cat("Total N:", ceiling(result$N), "\n") # Plot power curve result <- pwr.t.test(d = 0.5, sig.level = 0.05, power = NULL, n = seq(10, 200, by = 5)) plot(result)
GPower (gpower.hhu.de) is a free, widely-used GUI application for power analysis:
Do NOT blindly use Cohen's conventions. Instead:
| Mistake | Problem | Solution | |---------|---------|----------| | Post hoc power analysis | Circular and uninformative after data collection | Only do a priori power analysis | | Using Cohen's "medium" by default | May be unrealistic for your field | Base on literature or SESOI | | Ignoring attrition | Actual N may be lower than planned | Inflate N by 10-20% for expected dropout | | Forgetting multiple comparisons | Bonferroni corrections reduce power | Adjust alpha for the number of tests | | Not reporting power analysis | Reviewers cannot evaluate adequacy | Always report in Methods section |
A priori power analysis was conducted using [G*Power 3.1 / statsmodels / R pwr].
For a [test name] with an expected effect size of [d/r/f = X] (based on
[source: previous study / meta-analysis / pilot data]), alpha = .05, and
power = .80, the required sample size was [N per group / total N]. To account
for an estimated [X]% attrition rate, we recruited [final N] participants.| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | pass→pass | 8,689 | 6,106 | -30% | 1 | 1 | 0% | 1,659 | 3,373 | +103% | 0 | 0 | — |
case-01 | pass→pass | 13,487 | 19,655 | +46% | 1 | 1 | 0% | 2,788 | 4,613 | +65% | 0 | 0 | — |
case-03 | pass→pass | 14,061 | 4,848 | -66% | 1 | 1 | 0% | 2,840 | 3,293 | +16% | 0 | 0 | — |
case-04 | pass→pass | 8,398 | 6,123 | -27% | 1 | 1 | 0% | 1,671 | 3,512 | +110% | 0 | 0 | — |
case-05 | pass→pass | 19,424 | 7,253 | -63% | 1 | 1 | 0% | 3,938 | 3,786 | -4% | 0 | 0 | — |
case-06 | pass→pass | 8,630 | 10,950 | +27% | 1 | 1 | 0% | 1,840 | 3,910 | +113% | 0 | 0 | — |
case-16 | pass→pass | 15,821 | 18,421 | +16% | 1 | 1 | 0% | 2,642 | 5,374 | +103% | 0 | 0 | — |
case-07 | pass→pass | 8,204 | 6,367 | -22% | 1 | 1 | 0% | 1,508 | 3,382 | +124% | 0 | 0 | — |
case-08 | pass→pass | 5,482 | 6,531 | +19% | 1 | 1 | 0% | 1,100 | 3,418 | +211% | 0 | 0 | — |
case-09 | pass→pass | 8,117 | 5,139 | -37% | 1 | 1 | 0% | 1,489 | 3,148 | +111% | 0 | 0 | — |
case-10 | pass→pass | 14,637 | 4,727 | -68% | 1 | 1 | 0% | 1,132 | 2,997 | +165% | 0 | 0 | — |
case-11 | pass→pass | 9,219 | 7,627 | -17% | 1 | 1 | 0% | 1,783 | 3,651 | +105% | 0 | 0 | — |
case-12 | pass→pass | 8,656 | 4,096 | -53% | 1 | 1 | 0% | 1,805 | 3,087 | +71% | 0 | 0 | — |
case-13 | fail→pass | 15,434 | 7,999 | -48% | 1 | 1 | 0% | 2,709 | 3,697 | +36% | 0 | 0 | — |
case-14 | pass→pass | 15,372 | 17,285 | +12% | 1 | 1 | 0% | 2,435 | 4,970 | +104% | 0 | 0 | — |
case-15 | pass→pass | 11,704 | 12,230 | +4% | 1 | 1 | 0% | 2,016 | 4,353 | +116% | 0 | 0 | — |
case-17 | pass→pass | 18,438 | 17,759 | -4% | 1 | 1 | 0% | 3,137 | 5,336 | +70% | 0 | 0 | — |
case-18 | pass→pass | 14,769 | 13,862 | -6% | 1 | 1 | 0% | 2,923 | 4,874 | +67% | 0 | 0 | — |
case-19 | pass→pass | 17,988 | 20,192 | +12% | 1 | 1 | 0% | 2,964 | 5,780 | +95% | 0 | 0 | — |
case-20 | pass→pass | 9,776 | 8,783 | -10% | 1 | 1 | 0% | 1,757 | 3,813 | +117% | 0 | 0 | — |
case-21 | pass→pass | 10,003 | 8,838 | -12% | 1 | 1 | 0% | 1,854 | 3,702 | +100% | 0 | 0 | — |
case-22 | pass→pass | 6,553 | 5,037 | -23% | 1 | 1 | 0% | 1,299 | 3,175 | +144% | 0 | 0 | — |
case-23 | pass→pass | 14,689 | 14,378 | -2% | 1 | 1 | 0% | 2,510 | 4,672 | +86% | 0 | 0 | — |
case-24 | pass→pass | 11,037 | 14,312 | +30% | 1 | 1 | 0% | 2,133 | 4,405 | +107% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted. The headline lift of +4 percentage points is the difference between those two pass rates over the 24 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.