Skip to main content
Glama

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.

Input 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 analyzed 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 standardized 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

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. Changed2 schema fields changed
    • changedInput schema / properties / effect / description
      Previous value: -"the 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."New value: +"the standardized 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."
    • changedInput schema / properties / test / description
      Previous value: -"which 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)."New value: +"which test the experiment will be analyzed 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)."
  2. First observed

TDQS

A3.7/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false and openWorldHint=false, so the safety profile is covered and the description is not obliged to repeat it. Beyond that the description adds little behavioral context: it does not say that exactly one quantity is solved per call, that the answer is bound to the chosen test, or how conventional effect_size inputs affect the result. Adequate against the annotation baseline but not rich.

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

Conciseness5/5

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

A single compact sentence, front-loaded with what is computed and structured as an either/or that mirrors the two real workflows. No restatement of the title and no filler.

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

Completeness3/5

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

Output schema exists and parameter coverage is complete, so return values and argument meaning are documented elsewhere. However, this is a 26-parameter tool with 5 enums and nested objects, and the description omits the key operational fact that one call solves for one quantity selected by solve_for; an agent could reasonably try to obtain sample size and power in the same call.

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

Parameters3/5

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

Schema description coverage is 100%, including detailed per-parameter applicability notes and enum explanations, so the schema does the heavy lifting and the baseline is 3. The description contributes no parameter-level meaning of its own—it names the outcomes (power, detectable effect, significance level) conceptually but never mentions test, solve_for, or the one-quantity-at-a-time rule.

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

Purpose4/5

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

The description names a specific verb+resource (power and sample-size calculation for experiment design) and states both directions of use: sizing a planned test and characterizing a fixed design. It is clear on its own, but it never distinguishes itself from adjacent siblings such as calculate_rnaseq_power, simulate_rnaseq_power, plan_rnaseq_experiment or estimate_effect_size, so an agent must infer the boundary.

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 gives two concrete usage contexts: you have no design yet and want the replicate count, or you have a fixed design and want power / detectable effect / significance level. That is clear when-to-use context. It stops short of exclusions—nothing says to prefer calculate_rnaseq_power for sequencing designs or estimate_effect_size for deriving an effect from data.

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