Catalog/stat-pearson-correlation

Calculators

Pearson correlation coefficient API

Compute the Pearson correlation r = Σ(x−x̄)(y−ȳ)/√(Σ(x−x̄)²Σ(y−ȳ)²) for paired data, with r², a t-test for significance, and a strength rating. Auditable: returns df and p-value. Answers 'correlation between x and y','is the relationship significant','how strong is the correlation'.

Price$0.01per request
MethodPOST
Route/v1/calc/stat-pearson-correlation
StatusLive
MIME typeapplication/json
Rate limit120/minute
CacheNo cache
calcstatisticscorrelationpearsonr-squaredassociationlinearsignificance
API URLhttps://x402.hexl.dev/v1/calc/stat-pearson-correlation
Integration docs
Example request
{
  "x": [
    1,
    2,
    3,
    4,
    5
  ],
  "y": [
    2,
    4,
    5,
    4,
    5
  ]
}
Example response
{
  "r": 0.774597,
  "rSquared": 0.6,
  "n": 5,
  "df": 3,
  "t": 2.12132,
  "pValue": 0.124027,
  "direction": "positive",
  "rating": "strong",
  "interpretation": "r=0.7746 (strong positive); r²=0.6, p=0.124."
}
Input schema
{
  "type": "object",
  "required": [
    "x",
    "y"
  ],
  "properties": {
    "x": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "description": ">=3 values",
      "examples": [
        [
          1,
          2,
          3,
          4,
          5
        ]
      ]
    },
    "y": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "examples": [
        [
          2,
          4,
          5,
          4,
          5
        ]
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}