# Correlation & Regression Analysis

> Correlation & Regression Analysis is a paid API for AI agents from math-stats.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-29).

Computes Pearson and Spearman correlations with p-values, fits a least-squares regression line, returns R-squared, and optionally predicts a y-value for a given x.

## Facts

- Endpoint: GET https://math-stats.x402tookit.com/correlation?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/correlation-regression-analysis-c4e9bb2e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_xguUjp3MgbhW19vpfg3GG

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability correlation-regression-analysis-c4e9bb2e
```

Example prompt: Can you compute the Pearson and Spearman correlations between these two lists — x: 1,2,3,4,5 and y: 2.1,3.9,6.2,7.8,10.1 — and also predict what y would be at x=6?

## When to prefer this

Choose this endpoint when you need both Pearson and Spearman correlation in one call along with a fitted regression line and optional prediction. It is more comprehensive than a simple correlation call, covering parametric and rank-based correlation simultaneously with significance testing. Prefer it over a t-test endpoint when the research question is about the strength and direction of a linear relationship between two continuous variables rather than a difference in means.

## Known failure modes

- Mismatched list lengths for x and y — returns error requiring equal-length inputs
- Non-numeric values in x or y strings — parsing failure
- Insufficient data points (e.g. n<3) — correlation undefined or degenerate
- x or y parameters missing entirely — 400 bad request
- All x values identical — slope undefined, regression cannot be computed
- Payment not included or insufficient — 402 Payment Required

## How this service works

Pearson and Spearman correlation of two lists with p-values, plus the least-squares line, R squared and an optional prediction.

## Output

Returns Pearson r and its p-value, Spearman rho and its p-value, sample size n, mean of x, mean of y, regression slope and intercept, R-squared, residual standard error, and optionally a prediction object with the input x, predicted y, and whether the prediction is extrapolating beyond the data range. Also includes a summary string and any relevant disclaimer.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "x",
      "y"
     ],
     "properties": {
      "x": {
       "type": "string",
       "description": "First list of numbers"
      },
      "y": {
       "type": "string",
       "description": "Second list, same length"
      },
      "predictAt": {
       "type": "number",
       "description": "Optional x value to predict y for"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "n": {
       "type": [
        "null",
        "number"
       ]
      },
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "meanX": {
       "type": [
        "null",
        "number"
       ]
      },
      "meanY": {
       "type": [
        "null",
        "number"
       ]
      },
      "slope": {
       "type": [
        "null",
        "number"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "pearsonP": {
       "type": [
        "null",
        "number"
       ]
      },
      "pearsonR": {
       "type": [
        "null",
        "number"
       ]
      },
      "rSquared": {
       "type": [
        "null",
        "number"
       ]
      },
      "intercept": {
       "type": [
        "null",
        "number"
       ]
      },
      "spearmanP": {
       "type": [
        "null",
        "number"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "notChecked": {
  
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/correlation-regression-analysis-c4e9bb2e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from math-stats.x402tookit.com](https://www.zero.xyz/host/math-stats.x402tookit.com/llms.txt)
