{
    "name": "Confidence Interval for a Proportion Calculator",
    "url": "https://calculators.geekmidst.com/calculators/confidence-interval-proportion-calculator",
    "markdown": "https://calculators.geekmidst.com/calculators/confidence-interval-proportion-calculator.md",
    "category": "Statistics & probability",
    "description": "Get a confidence interval for a proportion from successes and trials by the Wilson, Clopper–Pearson exact, Agresti–Coull or Wald method, compared in a table.",
    "summary": "From x successes in n trials, find the plausible range for the true proportion. Four standard methods are computed so you can see how much the choice matters.",
    "also_called": [
        "Binomial confidence interval calculator"
    ],
    "applies_to": "Worldwide",
    "last_updated": "2026-10-29",
    "computation": "Results are computed in the visitor’s browser on the HTML page. This API describes the calculator; it does not compute results.",
    "inputs": [
        {
            "name": "x",
            "label": "Successes (x)",
            "type": "number",
            "default": "7"
        },
        {
            "name": "n",
            "label": "Trials (n)",
            "type": "number",
            "default": "20"
        },
        {
            "name": "confidence",
            "label": "Confidence level",
            "type": "number",
            "default": "95",
            "unit": "%"
        },
        {
            "name": "method",
            "label": "Method",
            "type": "select",
            "default": "wilson",
            "options": {
                "wilson": "Wilson score (recommended)",
                "clopper_pearson": "Clopper–Pearson exact",
                "agresti_coull": "Agresti–Coull",
                "wald": "Wald (normal approximation)"
            }
        }
    ],
    "outputs": [
        {
            "key": "lower",
            "label": "Lower limit",
            "format": "percent"
        },
        {
            "key": "upper",
            "label": "Upper limit",
            "format": "percent"
        },
        {
            "key": "p_hat",
            "label": "Sample proportion",
            "format": "percent"
        },
        {
            "key": "half_width",
            "label": "Half-width (points)",
            "format": "percent"
        },
        {
            "key": "method",
            "label": "Method",
            "format": "text"
        }
    ],
    "formula": {
        "text": "Wald: p̂ ± z√(p̂(1 − p̂)/n);  Wilson: (p̂ + z²/2n ± z√(p̂(1 − p̂)/n + z²/4n²)) ÷ (1 + z²/n);  Agresti–Coull: Wald on p̃ = (x + z²/2) ÷ (n + z²);  Clopper–Pearson: Beta(α/2; x, n − x + 1) to Beta(1 − α/2; x + 1, n − x)",
        "variables": {
            "x": "successes",
            "n": "trials",
            "p̂": "x ÷ n",
            "z": "two-sided normal critical value",
            "Beta(q; a, b)": "quantile of the beta distribution"
        }
    },
    "worked_example": {
        "inputs": {
            "x": "7",
            "n": "20",
            "confidence": "95",
            "method": "wilson"
        },
        "steps": [
            "p̂ = 7 ÷ 20 = 0.35; z = 1.96, z² = 3.8415.",
            "Centre = (0.35 + 0.09604) ÷ 1.19207 = 0.37417; half-width = 1.6442 × √(0.011375 + 0.002401) = 0.19296.",
            "Interval: 0.1812 to 0.5671. The exact method gives 0.1539 to 0.5922."
        ],
        "result": "With 7 successes in 20 trials, the 95% Wilson interval for the true proportion is about 18.1% to 56.7%."
    },
    "interpretation": "A wide interval means the data say little; collect more trials to narrow it. Wilson is a good default; Clopper–Pearson is conservative (wider) but guarantees at least the stated coverage.",
    "assumptions": [
        "Independent trials with a constant probability of success (a binomial model).",
        "Two-sided intervals; limits are clipped to 0–100%."
    ],
    "limitations": [
        "The Wald interval performs poorly for small n or proportions near 0 or 1, and is shown mainly for comparison."
    ],
    "rules": null,
    "faqs": [
        {
            "question": "What if I observed 0 successes?",
            "answer": "Wald gives a useless 0 to 0. Wilson and Clopper–Pearson still give a sensible upper limit; for 0 of n the exact 95% upper limit is 1 − 0.025^(1/n), close to the “rule of three” 3 ÷ n."
        },
        {
            "question": "Which method do software packages use?",
            "answer": "R’s binom.test uses Clopper–Pearson; prop.test uses Wilson with a continuity correction; many survey tools use Wald."
        }
    ],
    "sources": [],
    "related": [
        {
            "name": "Wilson Score Interval Calculator",
            "url": "https://calculators.geekmidst.com/calculators/wilson-score-interval-calculator"
        },
        {
            "name": "Confidence Interval Calculator",
            "url": "https://calculators.geekmidst.com/calculators/confidence-interval-calculator"
        },
        {
            "name": "Sample Size Calculator",
            "url": "https://calculators.geekmidst.com/calculators/sample-size-calculator"
        },
        {
            "name": "A/B Test Significance Calculator",
            "url": "https://calculators.geekmidst.com/calculators/ab-test-conversion-significance-calculator"
        }
    ],
    "disclaimer": null,
    "publisher": "GM¹X CalcVerse"
}