calc-sample-size
Installation
SKILL.md
Calc-Sample-Size Skill
You are assisting a medical researcher with sample size and power calculations. Guide the user through test selection using the decision tree, generate reproducible code in R (primary) and Python (alternative), interpret effect sizes clinically, and produce IRB-ready justification text.
Reference Files
- Formulas:
${CLAUDE_SKILL_DIR}/references/formulas.md-- mathematical formulas, R/Python functions, effect size conventions - Observational cohort precision branch:
${CLAUDE_SKILL_DIR}/references/observational_cohort.md - Prediction-model / medical-AI sample size (Riley):
${CLAUDE_SKILL_DIR}/references/prediction_model_sample_size.md-- the current TRIPOD+AI-aligned standard for a clinical prediction/classification model (development viapmsampsize, external validation viapmvalsampsize, net-benefit precision). Use this instead of EPV-10 whenever the goal is risk prediction for use rather than a single-predictor hypothesis test (Tests 12-13). - MRMC reader-study sample size (Obuchowski–Rockette):
${CLAUDE_SKILL_DIR}/references/mrmc_reader_study_sample_size.md-- sizing a multi-reader multi-case study ("do readers read better with the AI"; AI-vs-reader non-inferiority). The single-reader precision calc (Test 1) under-sizes it because readers are a random effect; size on readersJand cases via the OR framework, from pilot/literature variance components (RJafroc/MRMCaov/iMRMC). Use whenever a reader study is the design (Test 14). - Segmentation-metric precision (Dice / HD95 / NSD):
${CLAUDE_SKILL_DIR}/references/segmentation_metric_sample_size.md-- sizing a segmentation validation by the precision of the per-case overlap/boundary score (not a proportion):n ≈ (1.96·SD/δ)²from the pilot SD of per-case Dice, per structure (size on the worst), bootstrap-BCa CI, paired for a model comparison, and size the external cohort. Use whenever the outcome is Dice/HD95/NSD (Test 15). - Between-model comparison sample size:
${CLAUDE_SKILL_DIR}/references/multi_model_comparison_sample_size.md-- sizing a study whose claim is that one model beats others (several models head-to-head). Single-model precision under-sizes it: power the difference. Pair the design (same cases through all models) → size on the SD of the per-case difference; DeLong for a paired ΔAUC, bootstrap-paired for ΔDice; for >2 models pre-specify one primary contrast or pay the family-wise multiplicity; and for a ranking claim, seed for rank stability (Nadeau–Bengio variance, Demšar critical-difference). Use whenever the endpoint is "model A > B/C/…" (Test 16). - Segmentation usability sample size:
${CLAUDE_SKILL_DIR}/references/segmentation_acceptability_sample_size.md-- sizing a usability claim rather than a metric: the acceptability endpoint is a proportion (n ≈ (z/δ)²p(1−p), size on the pessimistic p, size per structure class); ratings by m readers are nested, so pooling n·m overstates precision by1+(m−1)ρ; bounding a catastrophic-failure rate needs the rule of three (≤1% ⇒ ~300 clean cases — a metric-precision study bounds nothing); edit time is a paired per-case difference sized per structure and per site. Use whenever the claim is "clinicians can use this" (Test 17). - Justification prose exemplars:
${CLAUDE_SKILL_DIR}/references/justification_examples.md-- reviewer-safe IRB/Methods justification paragraphs per design (proportions, means, DTA precision, survival/log-rank, ICC agreement, non-inferiority), each stating the five required elements; load when producing the justification text - Existing R template: See
analyze-statsskill atreferences/templates/sample_size.Rfor the 7 original tests