Catalog/psy-proportion-margin-of-error

Statistics

Survey margin of error API

Computes the margin of error and confidence interval for a survey proportion, with optional finite population correction. Answers 'What is the +/- margin of error on this poll result?', 'How does a finite population shrink my MoE?'.

Price$0.04per request
MethodPOST
Route/v1/stats/proportion-margin-of-error
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
surveymargin-of-errorproportionpollingconfidence-intervalfinite-populationsamplingprecision
API URLhttps://x402.hexl.dev/v1/stats/proportion-margin-of-error
Integration docs
Example request
{
  "proportion": 0.5,
  "sampleSize": 1000,
  "populationSize": 5000
}
Example response
{
  "marginOfError": 0.027721,
  "marginOfErrorPercent": 2.7721,
  "proportion": 0.5,
  "sampleSize": 1000,
  "confidence": 0.95,
  "zCritical": 1.959964,
  "standardError": 0.014144,
  "finitePopulationCorrection": 0.894517,
  "ciLower": 0.472279,
  "ciUpper": 0.527721,
  "interpretation": "±2.77 percentage points at 95% confidence"
}
Input schema
{
  "type": "object",
  "required": [
    "proportion",
    "sampleSize"
  ],
  "properties": {
    "proportion": {
      "type": "number",
      "description": "observed proportion 0..1",
      "examples": [
        0.5
      ]
    },
    "sampleSize": {
      "type": "integer",
      "examples": [
        1000
      ]
    },
    "confidence": {
      "type": "number",
      "default": 0.95
    },
    "populationSize": {
      "type": "integer",
      "description": "optional; enables finite population correction"
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}