- name
SKILL.md
Le fichier du skill reste dans le dépôt de l'éditeur.
Collez la commande copiée dans un terminal. Elle installe ce SKILL.md dans cet agent.
npx skills add Aperivue/medsci-skills --skill calc-sample-size -a cursor -yCollez la commande copiée dans un terminal. Elle installe ce SKILL.md dans cet agent.
npx skills add Aperivue/medsci-skills --skill calc-sample-size -a claude-code -yCollez la commande copiée dans un terminal. Elle installe ce SKILL.md dans cet agent.
npx skills add Aperivue/medsci-skills --skill calc-sample-size -a codex -yCollez la commande copiée dans un terminal. Elle installe ce SKILL.md dans cet agent.
npx skills add Aperivue/medsci-skills --skill calc-sample-size -a grok -yEnvoyez le message copié dans un chat Grok Bot. Le Bot récupère ce SKILL.md sur GitHub et l'ajoute aux skills que partagent tous vos Bots.
Install this skill: https://github.com/Aperivue/medsci-skills/tree/HEAD/skills/calc-sample-sizeDe l'éditeur
Walk the user through this tree one question at a time; do not assume answers. Reader studies, segmentation and model-comparison designs sit outside the tree: see Tests 14–17.
What is your primary outcome?
|
+-- Binary (yes/no, positive/negative)
| |
| +-- Paired data (same subjects, two methods)?
| | +-- YES --> [5] McNemar test
| | +-- NO --> How many groups?
| | +-- 2 groups, superiority --> [4] Two-proportion comparison (chi-square)
| | +-- 2 groups, non-inferiority --> [10] Non-inferiority / equivalence
| | +-- Multivariable model --> single-predictor hypothesis test? --> [9] Logistic regression
| | --> clinical prediction / AI model for use?
| | +-- developing the model --> [12] Prediction-model development (Riley)
| | +-- externally validating --> [13] External-validation (Riley)
| |
+-- Continuous (measurement, score)
| |
| +-- How many groups?
| +-- 2 groups --> [6] Independent t-test
| +-- 3+ groups --> [8] One-way ANOVA
|
+-- Time-to-event (survival, recurrence)
| |
| +-- Two groups, unadjusted --> [7] Log-rank test
| +-- Multivariable / adjusted HR --> [7] Log-rank (Schoenfeld) + [11] Cox EPV
|
+-- Agreement (inter-rater, reproducibility)
| |
| +-- Continuous measurements --> [2] ICC
| +-- Categorical ratings --> [3] Kappa
|
+-- Diagnostic accuracy (Se, Sp, AUC precision)
|
+--> [1] Diagnostic accuracy (precision-based)
Once the test is chosen, read ${CLAUDE_SKILL_DIR}/references/formulas.md § Test N — the
parameter table with defaults, the effect-size interpretation, the formula, R/Python code and the
methodological reference.
formulas.md § Margin selection).Each has its own reference file (parameters, method, reporting); read it once the test is chosen.
pmsampsize).pmvalsampsize); ≥ 100 events and ≥ 100 non-events is only a floor.
For Tests 12–13 read ${CLAUDE_SKILL_DIR}/references/prediction_model_sample_size.md.J × cases from pilot/literature variance components with RJafroc / MRMCaov / iMRMC (do not
hand-roll the OR algebra) and report the J × N power grid. Read
${CLAUDE_SKILL_DIR}/references/mrmc_reader_study_sample_size.md.n ≈ (1.96·SD/δ)² from the pilot SD of per-case Dice, sized on the worst
structure; CI by patient-level bootstrap (BCa). This is precision; a comparison is Test 16. Read
${CLAUDE_SKILL_DIR}/references/segmentation_metric_sample_size.md.n = ((z₁₋α/₂ + z₁₋β)·SD_Δ/Δ)² (a CI sized to just exclude zero has ~50% power), not
each model's precision; for > 2 models pre-specify one primary contrast or pay the
family-wise correction; a ranking claim needs multiple seeds. Read
${CLAUDE_SKILL_DIR}/references/multi_model_comparison_sample_size.md.DE ≈ 1 + (m−1)ρ holds
only when each case has its own readers — the same readers on every case (crossed) add a reader term
more cases cannot shrink; bounding failures at ≤ 1% needs ~300 clean cases (rule of three). Read
${CLAUDE_SKILL_DIR}/references/segmentation_acceptability_sample_size.md.Do not compute adaptive trials (group-sequential, sample size re-estimation), cluster-randomized trials (design effect, ICC-based inflation), Bayesian sample size determination, crossover designs, or multi-endpoint correction (mention Bonferroni if asked, but do not compute corrected sample sizes). Say the design is beyond this skill and point to G*Power (free, https://www.psychologie.hhu.de/gpower), PASS, or a biostatistician.
When the dataset already exists, formal power analysis is often impractical. Offer:
${CLAUDE_SKILL_DIR}/references/observational_cohort.md and report
event budget / confidence-interval precision instead of forcing a prospective recruitment-style
power calculation.total exams in period × prevalence × (1 − exclusion rate) = expected N.
Ask for the annual exam volume for the modality, study period, prevalence and exclusion rate. This
gives a realistic upper bound for N.${CLAUDE_SKILL_DIR}/references/justification_examples.md § Retrospective.Use a formal calculation (Phase 3) even for a retrospective study when a subset is enrolled prospectively, the primary analysis tests a hypothesis (not just estimation), the journal's Instructions for Authors require a power analysis, or the IRB requires it.
formulas.md or the test's reference file; any other reference needs a DOI/PMID confirmed via
/search-lit, otherwise mark it [UNVERIFIED - NEEDS MANUAL CHECK]. Mark an effect size,
clinical definition or threshold you could not confirm [VERIFY].protocol/sample_size_justification.md and the scripts as
protocol/sample_size_calc.R / .py: /write-protocol and /write-paper embed that text
verbatim, so the numbers are never retyped.If a parameter is uncertain or the effect-size estimate is vague, flag it and offer a table of N across plausible values (e.g., varying effect size, or power from 0.80 to 0.90).
Always structure the final output as follows:
## Sample Size Calculation Report
### Study Design
[1-2 sentence summary of the design and test selected]
### Parameters
| Parameter | Value | Source |
|-----------|-------|--------|
| ... | ... | user / literature / convention |
### Result
- **Required sample size**: N = [value]
- **With [X]% attrition adjustment**: N_adj = [value]
### R Code (Reproducible)
```r
# [complete, self-contained R script]
# Dependencies: [list packages]
# Run: Rscript sample_size_calc.R
# [complete, self-contained Python script]
# Dependencies: [list packages]
# Run: python sample_size_calc.py
A sample of [N] participants is required to detect [effect description] with [power]% power at a [one/two]-sided significance level of [alpha], assuming [key assumptions]. Accounting for an estimated [X]% attrition rate, we plan to enroll [N_adj] participants. This calculation is based on [formula/method reference].
[Cohen's benchmark classification + clinical meaning in the context of this study]
The IRB text must state N; name the test and its formula source; give every assumed parameter
(effect size, alpha, power); state the attrition adjustment and final enrollment target; cite the
methodological reference (e.g., "Schoenfeld, 1981"); and use formal, third-person language. Read
`${CLAUDE_SKILL_DIR}/references/justification_examples.md` for per-design exemplars when writing it.
Use when planning how many patients or cases a study needs before data collection (power analysis, IRB justification). Walks a decision tree to the right test and returns reproducible R/Python code an
---name: calc-sample-sizedescription: Use when planning how many patients or cases a study needs before data collection (power analysis, IRB…---# skills/calc-sample-size/SKILL.mdVue d'ensemble
Use when planning how many patients or cases a study needs before data collection (power analysis, IRB justification). Walks a decision tree to the right test and returns reproducible R/Python code and IRB-ready justification text. Analyzing collected data is /analyze-stats.
FAQ
Téléchargez skills/calc-sample-size/SKILL.md auprès de l'éditeur, ou copiez le chemin et ouvrez le dépôt. PlugMCP répertorie le skill et n'héberge pas le fichier.
L'éditeur le maintient sur https://github.com/Aperivue/medsci-skills.
Claude, Cursor, Codex et Grok Build peuvent lire un SKILL.md que vous ajoutez depuis le dépôt de l'éditeur. Grok Bot l'installe lorsque vous envoyez dans un chat le lien du dossier GitHub du skill.