SkillsReviewed · Aperivue

calc-sample-size from Aperivue medsci-skills

calc-sample-size is an AI assistant skill for medical researchers planning patient or case counts, but its results depend on justified study assumptions and correctly executed statistical code. It supplies method selection, R and Python examples, and draft ethics review justifications, including specialist guidance for medical AI studies.

Researched 16 Nov 2026

In short.

calc-sample-size is an AI assistant skill for medical researchers planning patient or case counts, but its calculations and draft justifications require verification against the intended study design. It distinguishes statistical power from estimation precision and addresses prediction models, reader studies and segmentation evaluation. The references contain substantial worked examples and regression-test source, but no execution results establish that they pass. Some branches provide guidance without complete executable examples, and several basic examples omit the attrition adjustment required by the wider workflow.

Researched and written by an AI model and checked by a second AI model. How it works

Covers skills/calc-sample-size at commit e0ea3b0be3bf529aa0b94ee5fd8450e78848932c: SKILL.md, skill.yml, all eight supplied reference files and tests/test_worked_examples.py, together with the root LICENSE and THIRD-PARTY-NOTICES.md. Cross-linked sibling skills, the analyze-stats template, external statistical packages and cited publications are outside this scope. No installation, code execution or generated assistant output was tested. Runtime compatibility, numerical correctness beyond the documented examples, clinical suitability and ethics committee acceptance remain unassessed.

The overview

What the resource is

calc-sample-size is a folder of instructions, reference documents and test code within Aperivue’s medsci-skills repository. An AI assistant uses it to guide sample-size planning and draft reproducible calculations and justification text. The original source is [https://github.com/Aperivue/medsci-skills/tree/main/skills/calc-sample-size]. It is not presented as a standalone application.

Where it is useful

Its strongest feature is connecting the study’s claim to the quantity that needs sizing. Estimating sensitivity precisely, detecting a difference between models, and showing that clinicians can use a segmentation system are treated as different problems. This makes it useful when a research team needs more structure than a generic request to an assistant for a sample-size calculation.

The documentation is substantial, but generated scripts and prose cannot establish that the chosen design or assumptions are appropriate. Numerical correctness across the supported designs, assistant behavior and ethics committee acceptance have not been assessed through execution.

Who it fits

The intended users include clinical researchers preparing protocols, teams drafting institutional review board (IRB) submissions, and developers evaluating medical prediction or imaging models. Beginners receive explanations of inputs and methods; experienced users get formulas, package names and editable code. It fits teams able to justify their assumptions and review statistical outputs. Analysis of already collected data is assigned to a separate analyze-stats skill.

What it covers

The instructions define 17 method branches. Conventional topics include sensitivity and specificity precision, agreement between raters, independent and paired proportions, two-group means, survival outcomes, ANOVA, logistic regression, non-inferiority, equivalence and Cox model event counts. Outputs are intended to include parameters with sources, sample-size results, code and formal justification prose.

Specialist references cover clinical prediction-model development and external validation, multi-reader multi-case studies, segmentation metric precision, paired model comparisons and segmentation acceptability or failure-rate claims. A fixed-cohort reference examines event counts and confidence-interval precision when the available dataset determines the study size. These branches vary in how much executable code they supply.

Using it

What users need

The instructions use ${CLAUDE_SKILL_DIR} to locate references and describe running R through a shell. Following that path requires an assistant environment with access to the files, shell execution and Rscript. Python examples use packages such as SciPy and statsmodels. R dependencies vary by branch and include pwr, kappaSize, TOSTER, pmsampsize and pmvalsampsize. Supported assistant versions and minimum runtime versions are not established.

The scientific inputs are equally important: users need a primary outcome, sampling unit, effect or precision target, and relevant assumptions such as prevalence, attrition or event rates. Paired comparisons need the variability of within-case differences; reader studies need reader and case variance components. The skill cannot supply defensible study-specific values without supporting information.

How it works

The assistant first asks about the study and routes it to a method. It then collects parameters, explains defaults and seeks evidence for effect-size assumptions. The selected reference supplies formulas or package-based calculations. The workflow calls for R execution, reporting the printed result and generating justification text. In a project, it saves protocol/sample_size_justification.md alongside R and Python scripts; sibling writing skills are intended to embed that justification verbatim. Those downstream integrations are not established by the supplied folder alone.

Getting started

Keep SKILL.md, skill.yml and the references together so the assistant can resolve the cited files. The supplied material does not establish an installation command or a supported-host matrix. Prepare the dependencies for the chosen method before relying on its output. The worked-example harness also references skills/analyze-stats/references/templates/sample_size.R outside this folder, so its full default check can require more of the repository than this skill alone. Installation and execution were not performed.

A documented example

The two-proportion example assumes rates of 0.70 and 0.55, a two-sided significance level of 0.05 and 80% power. The reference reports 162 participants per group, or 324 total, using pwr in R and statsmodels in Python. These are documented example values, not reproduced results. Although its parameter table lists attrition, that example’s code prints the unadjusted count; an enrollment target still needs the relevant loss adjustment.

Assessment & evidence

Limits and inconsistencies

The instructions exclude adaptive trials, cluster-randomized trials, Bayesian sample-size determination, crossover designs and computed multi-endpoint corrections. However, the reader-study reference discusses crossover designs, and the model-comparison reference discusses multiplicity. These are contextual treatments; the files do not establish a general calculator for those excluded designs.

The stated goal of supplying both R and Python is not fully represented in every reference. Prediction-model examples are R-only, and the multi-reader reference names specialist tools without supplying a complete executable sizing example. The diagnostic decision tree mentions AUC precision, while Test 1’s actual code sizes sensitivity and specificity, so that block should not be assumed to size AUC.

Several basic examples, including two proportions, McNemar and the independent t-test, omit attrition calculations despite listing attrition in their parameter tables. The skill instructions also call for running R, while the metadata says the user runs emitted code. Execution responsibility needs to be explicit in the chosen assistant environment.

Why the distinctions matter

The resource’s practical value comes from keeping the calculation aligned with the intended claim. Its paired-comparison guidance sizes the difference between models, while its reader-study guidance accounts for variation between readers. Its prediction-model reference separates development and validation requirements from simple events-per-variable rules. These distinctions explain why a large-looking case count can still be inadequate for a particular conclusion; they do not establish that any individual study meets the necessary assumptions.

Other approaches

The skill points users with unsupported designs toward G*Power [https://www.psychologie.hhu.de/gpower], PASS or a biostatistician. For supported calculations, technically experienced teams could work directly with the named statistical packages, such as pwr, pmsampsize, pmvalsampsize, RJafroc, MRMCaov or iMRMC, while taking responsibility for method selection and reporting. The supplied evidence does not compare these options for usability, price or accuracy.

What supports the claims

The references provide parameter tables, formulas, methodological citations and worked outputs attributed to statistical packages or published examples. The test source extracts the actual R and Python blocks and compares their outputs with recorded expectations. Python dependency failures are treated as failures; unavailable R checks can be skipped unless --require-r is used.

The test file records earlier errors in survival, kappa and ANOVA calculations and contains regression cases for those areas. Its presence does not prove the cases now pass: no execution transcript is supplied. Many expectations are stored numbers rather than fresh independent package comparisons. Referenced papers, all possible parameter combinations and clinical applicability were not independently assessed.

Access & freshness

Costs

Operating cost is unknown. The supplied files do not specify assistant subscriptions, model usage, compute costs or statistical support fees. The MIT licence grants software rights free of charge, but that does not establish the total cost of using the skill. No execution-time or resource-consumption measurements are supplied.

Licence and reuse

The repository’s MIT licence permits use, modification, distribution and commercial reuse of software and associated documentation, provided the copyright and permission notices accompany copies or substantial portions. It includes no warranty.

The third-party notice identifies separate terms for material elsewhere in the repository, including guideline summaries, official templates and citation styles. It does not identify an exception for skills/calc-sample-size. Those repository-wide exceptions should not be treated as restrictions on this folder without further evidence, or ignored when copying additional repository content.

Source version

The supplied source snapshot is commit e0ea3b0be3bf529aa0b94ee5fd8450e78848932c, captured on 16 November 2026. Its pinned folder is [https://github.com/Aperivue/medsci-skills/tree/e0ea3b0be3bf529aa0b94ee5fd8450e78848932c/skills/calc-sample-size]. Recorded package versions describe the basis of particular worked examples; they do not establish compatibility with later releases. A release date, subsequent changes and the latest upstream state are unknown.

Before relying on an output

Specify the primary claim, sampling unit and planned analysis first. Supply documented effect sizes, prevalence, variability and margins instead of accepting defaults without justification. For specialist designs, confirm that the relevant reference provides an applicable calculation and obtain statistical input where it does not.

Run the chosen worked example with its documented inputs before adapting it, then reconcile the resulting count, attrition treatment and justification text. Record dependency versions and confirm that the saved scripts reproduce the reported numbers. If using the regression harness, inspect skipped checks and account for its dependency on the sibling analyze-stats template.

Evidence for this report

LICENSEnotice · checked 2026-11-16
THIRD-PARTY-NOTICES.mdnotice · checked 2026-11-16
skills/calc-sample-size/SKILL.mdselected · checked 2026-11-16
skills/calc-sample-size/skill.ymlselected · checked 2026-11-16