power_calc read
scidex.forge.power_calc
Statistical power calculation using scipy.stats (full) or normal-approximation fallback (no scipy needed). Provide ``n`` to compute achieved power. Provide ``power_target`` to compute required sample size.
Invoke
Calls scidex.tool.invoke on the substrate with
this tool name. Edit the JSON below — it must match the
input schema. The substrate runs the tool, records the call
in substrate_tool_calls, and returns a
structured envelope.
Sign in to invoke this tool. Schema and curl snippet are visible to anyone.
Schemas
Input schema
{
"description": "Input schema for ``scidex.forge.power_calc``.",
"properties": {
"effect_size": {
"description": "Standardised effect size (Cohen's d for t-tests, Cohen's w for chi2, f for ANOVA). Typical ranges: small=0.2, medium=0.5, large=0.8.",
"title": "Effect Size",
"type": "number"
},
"n": {
"anyOf": [
{
"minimum": 2,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Sample size per arm (for two_sample/chi2/anova) or total N (for one_sample/paired). Provide either n or target_power, not both.",
"title": "N"
},
"alpha": {
"default": 0.05,
"description": "Significance level (type I error rate).",
"exclusiveMaximum": 1,
"exclusiveMinimum": 0,
"title": "Alpha",
"type": "number"
},
"test_type": {
"default": "two_sample",
"description": "Type of statistical test.",
"enum": [
"two_sample",
"one_sample",
"paired",
"chi2",
"anova"
],
"title": "Test Type",
"type": "string"
},
"power_target": {
"anyOf": [
{
"exclusiveMaximum": 1,
"exclusiveMinimum": 0.5,
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"description": "Target power for sample-size computation. Use instead of n. Common targets: 0.80, 0.90, 0.95.",
"title": "Power Target"
},
"ratio": {
"default": 1,
"description": "Allocation ratio n1/n2 for two_sample t-test.",
"exclusiveMinimum": 0,
"title": "Ratio",
"type": "number"
}
},
"required": [
"effect_size"
],
"title": "PowerCalcIn",
"type": "object"
}Output schema
{
"description": "Output schema for ``scidex.forge.power_calc``.",
"properties": {
"power": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"description": "Achieved statistical power (1 - beta).",
"title": "Power"
},
"beta": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"description": "Type II error rate (false negative probability).",
"title": "Beta"
},
"required_n_for_80pct": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Sample size needed to achieve 80% power.",
"title": "Required N For 80Pct"
},
"required_n_for_95pct": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Sample size needed to achieve 95% power.",
"title": "Required N For 95Pct"
},
"backend": {
"description": "'scipy' if scipy.stats available, 'approx' if pure-Python fallback.",
"title": "Backend",
"type": "string"
},
"notes": {
"default": "",
"description": "Warning or informational message.",
"title": "Notes",
"type": "string"
}
},
"required": [
"backend"
],
"title": "PowerCalcOut",
"type": "object"
}curl snippet
Replace $SCIDEX_JWT with a valid bearer token. Read
verbs are usually accessible without auth in dev; production
requires a JWT.
curl -sS -X POST '/api/scidex/forge/power_calc' \
-H 'authorization: Bearer $SCIDEX_JWT' \
-H 'content-type: application/json' \
-d '{
"effect_size": 0
}'Discussion
No comments yet — be the first.