Agent skill

bio-clinical-biostatistics-power-sample-size

Computes sample size and power for clinical trials including continuous, binary, and time-to-event endpoints; superiority, non-inferiority, and equivalence designs; FDA 2016 non-inferiority margin selection with M1/M2 framework; Schoenfeld 1981 and Lakatos 1988 for survival; Schuirmann TOST and 80-125% bioequivalence; minimum clinically important difference (MCID) vs δ distinction. Use when justifying trial size in protocol or SAP per CONSORT 2025 item 7.

BioTender-maxgithub.com/BioTender-maxGitHub ↗
claude-codeships scriptsNOASSERTION
Install
npx skills add BioTender-max/awesome-bio-agent-skills --skill power-and-sample-size --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 3
SKILL.md size: 30 KB
Bundled scripts: yes
Path: skills/bioskills/power-and-sample-size/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 135
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

What it does

Computes sample size and power for clinical trials across endpoints (continuous, binary, time-to-event) and designs (superiority, non-inferiority, equivalence), including considerations for dropout, multiplicity, and stratification. It explains the δ vs MCID distinction, and offers design-specific guidance (e.g., NI with M1/M2 framework, Schoenfeld 1981 survival, Lakatos 1988 for non-PH, Schuirmann TOST for BE). It includes example formulas and code snippets illustrating how to compute n or power for various scenarios, and it discusses SD, event-driven calculations, and design effects (e.g., cluster-randomised, group-sequential). The tool emphasizes using when justifying trial size in protocol or SAP per CONSORT 2025 item 7.

How it works

  • It presents foundational distinctions between δ (alternative effect) and MCID, and provides putative postdoc rules of thumb (e.g., superiority: δ >= 1.5 × MCID; NI: M2 <= 0.5 × MCID).
  • It tabulates design-specific formulas and software, including two-sample t-test, two-sample proportions, Schoenfeld 1981 for survival under PH, Lakatos 1988 for complex survival, MaxCombo under NPH, NI fixed-margin, NI synthesis, Equivalence TOST, Group-sequential, SSR, Mehta-Pocock, and cluster designs.
  • It offers concrete code examples for: continuous outcomes (tt_ind_solve_power), binary outcomes (NormalIndPower and continuity correction debate), and survival calculations (Schoenfeld events function; converting events to n with follow-up and event rate; Lakatos using gsDesign and nSurv; non-PH via simtrial).
  • It includes specific NI and BE procedures, including fixed-margin NI sample size, M1/M2 framework, and MN-CI for rate differences; BE uses TOST concepts with 80-125% margins and cautions on analysis.
  • It provides crossover design guidance noting within-subject SD drives power and offering a two-period crossover example.

When to use it

Use when justifying trial size in protocol or SAP per CONSORT 2025 item 7, across scenarios listed (continuous, binary, time-to-event; superiority, NI, equivalence; BE and crossover considerations).

What it can touch

  • Primary tool: statsmodels
  • Supplementary tools and packages cited: R packages like pwr, gsDesign, rpact, presize, npsurvSS, nph, simtrial; Python equivalents via statsmodels.power and math-based calculations.

Caveats

  • The material emphasizes that events drive power in survival; sample size depends on expected event probability and follow-up, with dropout and prognostic stratification affecting effective n.
  • For non-PH, immuno-oncology scenarios, standard Schoenfeld 1981 underestimates required events by 20-50%; alternatives via Lakatos 1988 or simulation via simtrial are recommended.
  • Constancy assumptions in NI and external data integrity are noted as important considerations (including critiques on in-trial Type-I error guarantees).
From the SKILL.md

## Version Compatibility Reference examples tested with: statsmodels 0.14+, scipy 1.12+, numpy 1.26+, pandas 2.1+. R packages cited: pwr, gsDesign (Anderson/Merck), gsDesign2, rpact (Wassmer/Brannath), presize, npsurvSS, nph, simtrial. Before using code patterns, verify installed versions match. If versions differ: - Python: `pip show <package>` then `help(module.function)` to check signatures - R: `packageVersion('<pkg>')` then `?function_name` If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying. # Power and Sample Size for Clinical Trials **"Justify the trial's sample size"** -> Compute the n needed to detect a pre-specified alternative δ with power 1-β at significance α, accounting for endpoint distribution, design (superiority/NI/equivalence), expected dropout, multiplicity, and stratification — and distinguish δ (the effect the trial is powered to detect) from MCID (the clinically meaningful difference). ## The Foundational Distinction -- δ vs MCID **δ (the alternative effect):** what the trial is *powered to detect*. Usually set above the MCID because sponsors want a stro

What's inside
Steps it walks through
  1. Version Compatibility
  2. The Foundational Distinction -- δ vs MCID
  3. Algorithmic Taxonomy
  4. Decision Tree by Scenario
  5. Continuous Outcomes -- Two-Sample t-Test
  6. Binary Outcomes -- The Continuity Correction Debate
  7. Survival (Time-to-Event)
  8. Schoenfeld 1981 -- the canonical formula
  9. Lakatos 1988 -- complex survival
  10. Under non-PH (immuno-oncology with delayed effect)
  11. Non-Inferiority Designs -- The FDA 2016 Framework
  12. Equivalence Designs and Bioequivalence
  13. Crossover Designs -- Bioequivalence and Repeated-Measures
  14. Bioequivalence (FDA 1992 / EMA 2010 framework)
Ships with 2 files
  • examples/power_sample_size.py
  • usage-guide.md
More from awesome-bio-agent-skills
All skills →
About this skill
What does the bio-clinical-biostatistics-power-sample-size skill do?

Computes sample size and power for clinical trials including continuous, binary, and time-to-event endpoints; superiority, non-inferiority, and equivalence designs; FDA 2016 non-inferiority margin selection with M1/M2 framework; Schoenfeld 1981 and Lakatos 1988 for survival; Schuirmann TOST and 80-125% bioequivalence; minimum clinically important difference (MCID) vs δ distinction. Use when justifying trial size in protocol or SAP per CONSORT 2025 item 7.

How do I install it?

Run `npx skills add BioTender-max/awesome-bio-agent-skills --skill power-and-sample-size --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From BioTender-max/awesome-bio-agent-skills, a repository with 135 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going