# agent402.tools Pearson Correlation

> agent402.tools Pearson Correlation is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Computes the Pearson correlation coefficient (r), coefficient of determination (r²), and sample size (n) between two equal-length numeric arrays.

## Facts

- Endpoint: POST https://agent402.tools/api/correlation
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-pearson-correlation-319de8fa
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_R5ec-E018cS73qL1gU9hK

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 agent402-tools-pearson-correlation-319de8fa -d '<json body>'
```

Example prompt: Can you calculate the Pearson correlation between these two series — x: [1.2, 2.5, 3.1, 4.8, 5.0] and y: [2.4, 4.9, 6.0, 9.7, 10.1] — and tell me the r value, r², and sample size?

## When to prefer this

Use this endpoint when you need a fast, cheap ($0.001 USDC) computation of Pearson correlation between two numeric series without setting up a local statistics library. Ideal for AI agents that need on-the-fly correlation checks in workflows involving financial data, scientific measurements, or any paired numeric datasets.

## Known failure modes

- Arrays x and y have different lengths — returns error
- Non-numeric values in either array — returns error
- Empty arrays provided — returns error or undefined result
- Single-element arrays (n=1) — correlation undefined
- All values in one series are constant (zero variance) — division by zero, returns error or NaN

## How this service works

Pearson correlation coefficient between two equal-length numeric series. Returns r (the correlation, -1 to 1), r² (variance explained), n (sample size). Use this to ask things like: is a stock's daily return correlated with a macro indicator? Are two FRED series moving together?

## Output

Returns a JSON object with three fields: r (Pearson correlation coefficient, ranging -1 to 1), r² (proportion of variance in y explained by x), and n (number of data points used in the calculation).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "x": {
   "type": "array",
   "description": "First numeric series"
  },
  "y": {
   "type": "array",
   "description": "Second numeric series (same length as x)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "n": 5,
  "r": 1,
  "rSquared": 1,
  "interpretation": "perfect positive linear relationship"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-pearson-correlation-319de8fa/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
