Power analysis (sample size for a test)
power_analysisCalculates the sample size needed to detect an effect with a statistical test (a priori power analysis, matches G*Power to within 1–2 participants). Designs: two_group_t_test (Cohen's d), paired_t_test (d), one_sample_t_test (d), correlation (r), anova (Cohen's f, k groups), two_proportions (p1, p2). If the user does not know the effect size, use the conventional "medium" effect and say so.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"design": "<design>"
},
"name": "power_analysis"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| p1 | No | two_proportions only: proportion in group 1 (0–1). | |
| p2 | No | two_proportions only: proportion in group 2 (0–1). | |
| alpha | No | Default 0.05. | |
| power | No | Default 0.80. | |
| design | Yes | ||
| groups | No | anova only: number of groups. Default 3. | |
| dropout | No | Expected dropout %, to inflate the sample. Default 0. | |
| effect_size | No | Cohen's d (t-tests), r (correlation) or f (ANOVA). Small/medium/large: d .2/.5/.8, r .1/.3/.5, f .1/.25/.4. |