Sample Size
sample_sizeCalculate the survey sample size needed for a confidence level and margin. FREE.
Uses maximum variance (p=0.5) with a finite-population correction when population is given. Typical input {"population": 5000, "confidence_pct": 95, "margin_pct": 5} returns {"required_sample": 357, "assumptions": "p=0.5 (max variance), random sampling"}.
Use before collecting data, to size a survey. Not for analyzing data already collected (stats_describe, confidence_interval). Errors: on invalid, missing, or malformed input this tool never raises a protocol error — it returns {"error": ""} (for example {"error": "confidence_pct must be 90, 95, or 99"}). Every call is read-only and idempotent, so after correcting the input it is always safe to retry.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| margin_pct | No | Acceptable margin of error percentage; above 0 and at most 50. Default 5. | |
| population | No | Total population size; 0 (default) means unknown or very large. | |
| confidence_pct | No | Confidence level; must be 90, 95, or 99. Default 95. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||