# Sample size calculator

- Human page: https://happytails.ai/en/calculators/sample-size-calculator/
- Markdown: https://happytails.ai/en/calculators/sample-size-calculator.md
- Structured JSON: https://happytails.ai/agents/en/calculators/sample-size-calculator/index.json
- Visibility: public

## Tool capabilities

| Property | Value |
| --- | --- |
| Tool ID | `sample-size-calculator` |
| Category | calculators |
| Implementation | Registered implementation. Registration alone is not a production-quality guarantee. |
| Browser execution | Automatic updates after valid input or file selection. |
| Browser processing | Browser; see tool notes for network behavior. |
| HTTP API | Not callable through HTTP. |
| Browser-agent interface | run_current_tool |

### Implementation notes

Estimate required completed responses for precision, not hypothesis-test power. Population correction assumes random sampling without replacement. Response-rate planning does not guarantee enough responses.

### Inputs and settings

No free-text input is required. Use the file inputs and/or settings below.

| Setting | Meaning | Control type | Default | Constraints |
| --- | --- | --- | --- | --- |
| `method` | Plan an estimate of | select | "Proportion" | Allowed: Proportion, Mean (known planning SD) |
| `confidence` | Confidence level (%) | number | 95 | min=50 max=99.99 step=any |
| `margin` | Margin of error | number | 5 | min=1e-08 max=1000000000000 step=any |
| `proportion` | Expected proportion (%) | number | 50 | min=0.001 max=99.999 step=any |
| `sd` | Planning standard deviation | number | 10 | min=1e-12 max=1000000000000 step=any |
| `population` | Finite population (optional) | number | "" | min=2 max=1000000000 step=1 |
| `designEffect` | Design effect | number | 1 | min=0.01 max=1000 step=any |
| `responseRate` | Expected response rate (%) | number | 100 | min=0.01 max=100 step=any |

### Browser-agent workflow

1. Open the human page in a browser that supports WebMCP.
2. Discover the interface exposed by that page; use its actual schema.
3. Select files on the page first when the tool requires files.
4. Call `run_current_tool` with valid input and settings.
5. Inspect the returned result or error and the displayed output. Retrieve files from the displayed download links.

Calls do not automatically copy or download results. Browser permissions still apply. Interface availability alone is not proof of successful execution.

### Planning specification

Normal-approximation precision planning, not a power analysis. Confidence 50–99.99%; finite populations up to one billion. Expected proportions must be strictly between 0 and 100%. A low expected event count triggers a warning. Invitations can exceed the available population and are flagged.

This describes intended requirements. Use the implementation notes, interface schema and observed output to determine current support.

### Complete machine-readable capability record

```json
{
  "id": "sample-size-calculator",
  "category": "calculators",
  "built": true,
  "requirements": "Normal-approximation precision planning, not a power analysis. Confidence 50–99.99%; finite populations up to one billion. Expected proportions must be strictly between 0 and 100%. A low expected event count triggers a warning. Invitations can exceed the available population and are flagged.",
  "implementation": {
    "fields": [
      {
        "key": "method",
        "label": "Plan an estimate of",
        "value": "Proportion",
        "type": "select",
        "values": [
          "Proportion",
          "Mean (known planning SD)"
        ]
      },
      {
        "key": "confidence",
        "label": "Confidence level (%)",
        "value": 95,
        "type": "number",
        "min": 50,
        "max": 99.99,
        "step": "any"
      },
      {
        "key": "margin",
        "label": "Margin of error",
        "value": 5,
        "type": "number",
        "min": 1e-08,
        "max": 1000000000000,
        "step": "any",
        "help": "For a proportion, use percentage points: 5 means ±5 points. For a mean, use the measurement units."
      },
      {
        "key": "proportion",
        "label": "Expected proportion (%)",
        "value": 50,
        "type": "number",
        "min": 0.001,
        "max": 99.999,
        "step": "any",
        "help": "Use 50% when unsure. Very rare outcomes may make normal-approximation planning unreliable.",
        "showWhen": {
          "method": [
            "Proportion"
          ]
        }
      },
      {
        "key": "sd",
        "label": "Planning standard deviation",
        "value": 10,
        "type": "number",
        "min": 1e-12,
        "max": 1000000000000,
        "step": "any",
        "showWhen": {
          "method": [
            "Mean (known planning SD)"
          ]
        }
      },
      {
        "key": "population",
        "label": "Finite population (optional)",
        "value": "",
        "type": "number",
        "min": 2,
        "max": 1000000000,
        "step": 1,
        "required": false
      },
      {
        "key": "designEffect",
        "label": "Design effect",
        "value": 1,
        "type": "number",
        "min": 0.01,
        "max": 1000,
        "step": "any"
      },
      {
        "key": "responseRate",
        "label": "Expected response rate (%)",
        "value": 100,
        "type": "number",
        "min": 0.01,
        "max": 100,
        "step": "any"
      }
    ],
    "note": "Estimate required completed responses for precision, not hypothesis-test power. Population correction assumes random sampling without replacement. Response-rate planning does not guarantee enough responses.",
    "input": false,
    "live": true,
    "presentation": "metrics",
    "background": false,
    "inputMaxLength": 1000000,
    "inputErrorCode": "STAT_SIZE",
    "experience": {
      "automatic": true,
      "single": false,
      "inputMaxLength": 1000000,
      "inputMode": "text",
      "label": "Your text",
      "placeholder": "Type or paste your input…",
      "help": "Change the input or settings to update your result. Results update as you type. Up to 1,000,000 characters.",
      "action": null
    },
    "mode": "automatic",
    "interactive": false
  },
  "execution": "Browser interface",
  "api": null,
  "browser_agent": {
    "supported": true,
    "name": "run_current_tool",
    "discovery": "WebMCP on the human page in a supporting browser",
    "verification": "See audit/API-AUDIT.md; availability is not verification"
  }
}
```

## Page guide

Plan completed responses and invitations for a proportion or mean, with stated confidence, precision and population assumptions.

How can we improve this tool?

Report a problem or share an idea.

Please leave out private information. Your message and the tool name go to our team via PostHog.

### How to use Sample size calculator

1. Enter the observations or summary values.
2. Choose the method and check its assumptions.
3. Review the result and download the calculation.

## Useful next steps

- [Confidence interval calculator](https://happytails.ai/en/calculators/confidence-interval-calculator/) ([Markdown](https://happytails.ai/en/calculators/confidence-interval-calculator.md))

- [Probability calculator](https://happytails.ai/en/calculators/probability-calculator/) ([Markdown](https://happytails.ai/en/calculators/probability-calculator.md))

## Choose the model before reading the result

Plan completed responses and invitations for a proportion or mean, with stated confidence, precision and population assumptions.

### Check the assumptions

Normal-approximation precision planning, not a power analysis. Confidence 50–99.99%; finite populations up to one billion. Expected proportions must be strictly between 0 and 100%. A low expected event count triggers a warning. Invitations can exceed the available population and are flagged.

### Keep the calculation

Download the JSON for unrounded results and settings, CSV for the table, and the separate assumptions note. The calculation runs in your browser.
