{
    "name": "Pearson Correlation Calculator",
    "url": "https://calculators.geekmidst.com/calculators/pearson-correlation-calculator",
    "markdown": "https://calculators.geekmidst.com/calculators/pearson-correlation-calculator.md",
    "category": "Statistics & probability",
    "description": "Paste paired x and y data to get Pearson’s r, r², the t test of zero correlation (two- or one-sided p) and a Fisher z confidence interval for r.",
    "summary": "Pearson’s r measures how closely paired data follow a straight line, from −1 (perfect negative) through 0 (no linear relation) to +1 (perfect positive).",
    "also_called": [
        "Correlation coefficient calculator",
        "Pearson r 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": "X values",
            "type": "textarea",
            "default": "1, 2, 3, 4, 5"
        },
        {
            "name": "y",
            "label": "Y values (same order)",
            "type": "textarea",
            "default": "2, 4, 5, 4, 5"
        },
        {
            "name": "tail",
            "label": "Alternative hypothesis",
            "type": "select",
            "default": "two",
            "options": {
                "two": "Two-sided: ρ ≠ 0",
                "greater": "One-sided: ρ > 0",
                "less": "One-sided: ρ < 0"
            }
        },
        {
            "name": "confidence",
            "label": "Confidence level for r",
            "type": "number",
            "default": "95",
            "unit": "%"
        }
    ],
    "outputs": [
        {
            "key": "r",
            "label": "Pearson’s r",
            "format": "number"
        },
        {
            "key": "r2",
            "label": "r² (share of variance explained)",
            "format": "number"
        },
        {
            "key": "n",
            "label": "Pairs (n)",
            "format": "integer"
        },
        {
            "key": "t",
            "label": "t statistic (n − 2 df)",
            "format": "text"
        },
        {
            "key": "p_value",
            "label": "p-value",
            "format": "number"
        },
        {
            "key": "p_text",
            "label": "p-value and sidedness",
            "format": "text"
        },
        {
            "key": "ci",
            "label": "Confidence interval for ρ (Fisher z)",
            "format": "text"
        },
        {
            "key": "ci_lower",
            "label": "CI lower bound",
            "format": "number"
        },
        {
            "key": "ci_upper",
            "label": "CI upper bound",
            "format": "number"
        }
    ],
    "formula": {
        "text": "r = Sxy ÷ √(Sxx·Syy);  t = r·√((n − 2) ÷ (1 − r²)) with n − 2 df;  CI = tanh(atanh r ± z* ÷ √(n − 3))",
        "variables": {
            "Sxy": "Σ(x − x̄)(y − ȳ)",
            "Sxx, Syy": "sums of squared deviations of x and y",
            "n": "number of pairs",
            "z*": "two-sided standard normal critical value"
        }
    },
    "worked_example": {
        "inputs": {
            "x": "1, 2, 3, 4, 5",
            "y": "2, 4, 5, 4, 5",
            "tail": "two",
            "confidence": "95"
        },
        "steps": [
            "x̄ = 3, ȳ = 4. Sxy = 6, Sxx = 10, Syy = 6.",
            "r = 6 ÷ √(10 × 6) = 0.7746, so r² = 0.6.",
            "t = 0.7746 × √(3 ÷ 0.4) = 2.121 with 3 df: two-sided p = 0.124."
        ],
        "result": "The five pairs have r = 0.77, a fairly strong positive association, but with so few points it is not significant at 5% (p = 0.12)."
    },
    "interpretation": "r describes linear association only: a strong curved relation can give r near 0, and a single outlier can create or hide a correlation, so always look at a scatter plot. Correlation does not show which variable causes the other, or whether a third factor drives both.",
    "assumptions": [
        "Pairs are independent observations.",
        "For the p-value and interval: x and y are roughly bivariate normal (or n is large).",
        "The p-value is for the null hypothesis ρ = 0, with the sidedness you choose."
    ],
    "limitations": [
        "The Fisher z interval needs at least 4 pairs and is approximate for small n.",
        "For ranked or strongly non-normal data, use Spearman’s rank correlation."
    ],
    "rules": null,
    "faqs": [
        {
            "question": "What counts as a strong correlation?",
            "answer": "It depends on the field. As a rough guide, |r| around 0.1 is small, 0.3 moderate and 0.5 or more large, but a scatter plot says more than any label."
        },
        {
            "question": "Why do r and the regression slope have the same p-value?",
            "answer": "With one predictor, the test of zero correlation and the test of zero slope are the same t test."
        }
    ],
    "sources": [],
    "related": [
        {
            "name": "Spearman Correlation Calculator",
            "url": "https://calculators.geekmidst.com/calculators/spearman-correlation-calculator"
        },
        {
            "name": "Linear Regression Slope Calculator",
            "url": "https://calculators.geekmidst.com/calculators/linear-regression-slope-calculator"
        },
        {
            "name": "R-Squared Calculator",
            "url": "https://calculators.geekmidst.com/calculators/regression-r-squared-calculator"
        },
        {
            "name": "P-value Calculator",
            "url": "https://calculators.geekmidst.com/calculators/p-value-calculator"
        }
    ],
    "disclaimer": null,
    "publisher": "GM¹X CalcVerse"
}