Skip to main content
Glama

jean — Molecular Biology & Genomics

calculate_power

Read-only

Power and sample size for a planned experiment: how many replicates a test needs to detect an effect, or what power, detectable effect or significance level a design that is already fixed gives. Leave ONE quantity out with solve_for and it is solved; everything else is given. Thirteen tests in two families: Cohen's standardised effect sizes (pwr 1.3-0: t one/two-sample/paired and unequal n, one and two proportions by arcsine h, normal mean, correlation, chi-square w, one-way ANOVA f, linear-model f²) and raw units (R's power.t.test from a difference and SD, power.prop.test from two proportions, power.anova.test from variances). Every number is R's, reproduced: the solved value is uniroot's root at R's tolerance, and an unreachable target is refused with R's own message. Returns the power curve around the answer and the R call that reproduces it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
NNototal observations across every cell. Only applies when test is chisq.
kNonumber of groups. Only applies when test is anova.
nNoobservations per group (pairs, for paired; the sample, for one-sample and correlation). Only applies when test is t or two_proportions or one_proportion or normal_mean or correlation or anova or t_raw or proportions_raw or anova_raw.
uNonumerator degrees of freedom: the number of predictors tested. Only applies when test is linear_model.
vNodenominator degrees of freedom: n − u − 1 for n observations. Only applies when test is linear_model.
dfNodegrees of freedom of the chi-square test: (cells − 1) for goodness of fit, (rows − 1)(columns − 1) for independence. Only applies when test is chisq.
n1Noobservations in the first group. Only applies when test is t_unequal or two_proportions_unequal.
n2Noobservations in the second group. Only applies when test is t_unequal or two_proportions_unequal.
p1Nothe proportion in group 1. Only applies when test is proportions_raw.
p2Nothe proportion in group 2. Only applies when test is proportions_raw.
sdNothe standard deviation, in the same units (of the differences, for paired); R's default is 1. Only applies when test is t_raw.
testYeswhich test the experiment will be analysed with; the power answer belongs to that test and no other. Values: t (t test: one-sample, two-sample or paired, Cohen's d), t_unequal (two-sample t test, unequal group sizes, Cohen's d), two_proportions (two proportions, equal n, Cohen's h), two_proportions_unequal (two proportions, unequal n, Cohen's h), one_proportion (one proportion against a null value, Cohen's h), normal_mean (normal mean, known variance, effect d), correlation (Pearson correlation, r), chisq (chi-square goodness of fit or independence, Cohen's w), anova (balanced one-way ANOVA, Cohen's f), linear_model (linear model F test (multiple regression), Cohen's f²), t_raw (t test in raw units: difference and standard deviation), proportions_raw (two proportions in raw units: p1 and p2), anova_raw (balanced one-way ANOVA in raw units: between- and within-group variance).
typeNothe t test's design. Only applies when test is t or t_raw.two.sample
powerNo1 − β, the chance of detecting the effect if it is real. No default: the target is yours to choose.
_filesNoThe project: record references shaped like _subject. Their records become library documents a tool names in sequences/parts/document; a trace or alignment is found by file name.
effectNothe standardised effect: Cohen's d for t and normal-mean tests, h for proportions, r for correlation, w for chi-square, f for ANOVA, f² for the linear model. Give a value or `effect_size` instead. Only applies when test is t or t_unequal or two_proportions or two_proportions_unequal or one_proportion or normal_mean or correlation or chisq or anova or linear_model.
groupsNonumber of groups. Only applies when test is anova_raw.
strictNotwo-sided raw-unit tests: also count rejections in the wrong tail, as R's strict = TRUE. Only applies when test is t_raw or proportions_raw. Advanced.
_subjectNoThe record to act on: exactly one of sequence, accession (+source), sample (an id from list_samples) or file ({name, text} or {name, base64}); record_index picks one record of several.
sig_levelNoα, the type I error rate; R's default.
solve_forNothe one quantity to solve. Left unset it is the test's sample size (n; n2 for unequal groups, N for chi-square, v for the linear model). `effect` solves the smallest detectable effect.
differenceNoδ, the true difference in means, in the measurement's units. Only applies when test is t_raw.
within_varNovariance within groups. Only applies when test is anova_raw.
alternativeNotwo-sided, or the direction a one-sided test looks in (the raw-unit t and proportion tests take only two.sided or one.sided). Only applies when test is t or t_unequal or two_proportions or two_proportions_unequal or one_proportion or normal_mean or correlation or t_raw or proportions_raw.two.sided
between_varNovariance of the group means. Only applies when test is anova_raw.
effect_sizeNoCohen's conventional small, medium or large effect for this test (pwr's cohen.ES), when there is no estimate from data. A convention, not a measurement, and every answer built on it says so. Only applies when test is t or t_unequal or two_proportions or two_proportions_unequal or one_proportion or normal_mean or correlation or chisq or anova or linear_model.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
powerYesthe power of the design
rCallYesthe R call that reproduces the answer
valueYesthe solved quantity's value
solvedYeswhich quantity was solved
valuesYesevery quantity of the test, the solved one included, by R's name
warningsYesR's own warnings for this solve, verbatim
powerCurveYespower against the sample size, every other quantity held
wholeUnitsYesthe sample size rounded up to whole units and the power that whole number gives

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the readOnly/openWorld annotations, the description discloses material behavior: results reproduce R exactly (uniroot's root at R's tolerance), an unreachable target is refused with R's own message, and the response carries a power curve around the answer plus the reproducing R call. The caveat that effect_size is 'a convention, not a measurement' is honest and useful.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is front-loaded and sentences mostly earn their place, but the middle enumeration of the thirteen tests and their pwr effect-size mappings is dense and partially overlaps the test enum description. Slightly heavy, though not padded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present, return values needn't be explained, and the description still notes the curve and R call returned. Combined with full schema coverage and annotations, an agent has everything needed to select and call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning above the schema: solve_for's default resolves to the test's sample size (n/n2/N/v), and effect_size is flagged as a convention rather than a measured value. It adds framing without duplicating every field's syntax.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource+scope: 'Power and sample size for a planned experiment,' then delineates the two regimes (sizing a test vs. describing a fixed design). It enumerates thirteen tests across two families, which clearly scopes it apart from narrower siblings like calculate_rnaseq_power.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It states the operating rule plainly ('Leave ONE quantity out with solve_for and it is solved; everything else is given'), which tells the agent how to invoke it. It gives clear context for when the tool applies but names no explicit alternatives or exclusions (e.g., vs. calculate_rnaseq_power or estimate_effect_size).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources