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.
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.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
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).
## 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
- Version Compatibility
- The Foundational Distinction -- δ vs MCID
- Algorithmic Taxonomy
- Decision Tree by Scenario
- Continuous Outcomes -- Two-Sample t-Test
- Binary Outcomes -- The Continuity Correction Debate
- Survival (Time-to-Event)
- Schoenfeld 1981 -- the canonical formula
- Lakatos 1988 -- complex survival
- Under non-PH (immuno-oncology with delayed effect)
- Non-Inferiority Designs -- The FDA 2016 Framework
- Equivalence Designs and Bioequivalence
- Crossover Designs -- Bioequivalence and Repeated-Measures
- Bioequivalence (FDA 1992 / EMA 2010 framework)
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.
