# QuantOracle Linear Regression

> QuantOracle Linear Regression is a paid API for AI agents from api.quantoracle.dev, paid per call via x402, $0.008/call, status unknown (last checked 2026-09-14).

Fits an ordinary least squares linear regression to x/y data and returns coefficients, R-squared, p-values, t-statistics, F-statistic, and confidence-interval diagnostics.

## Facts

- Endpoint: POST https://api.quantoracle.dev/v1/stats/linear-regression
- Price: $0.008/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-quantoracle-dev-c49af2df
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_ZJfBL3MSe1OiaK3PdFkjx

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 api-quantoracle-dev-c49af2df -d '<json body>'
```

Example prompt: Run a linear regression on these five data points — x: [1, 2, 3, 4, 5] and y: [2.1, 3.9, 6.2, 7.8, 10.1] — using a 95% confidence level, and give me the slope, intercept, R-squared, and p-values.

## When to prefer this

Choose this endpoint when you need a full suite of OLS regression diagnostics (coefficients, R-squared, p-values, F-statistic, t-statistics, standard errors) in a single call, especially for quantitative finance or statistical analysis workflows where significance testing matters. Prefer it over generic statistics libraries when operating in an agentic/x402 payment context or when you need a hosted, pay-per-call computation without managing infrastructure.

## Known failure modes

- x and y arrays of mismatched length — returns 4xx validation error
- fewer than 2 data points provided — underdetermined system error
- non-numeric values in x or y arrays — type validation error
- confidence_level outside (0,1) range — parameter validation error
- payment not included or insufficient — x402 payment required response

## How this service works

QuantOracle: stats/linear-regression

## Output

Returns a JSON object with: sample size (n), mean squared error, root MSE, p-values for each predictor, intercept, R-squared, number of predictors, F-statistic, regression coefficients array, t-statistics, standard errors, and adjusted R-squared — all derived from an OLS fit of the provided x/y data.

## Example request

```json
{
 "input": {
  "body": {
   "x": [
    1,
    2,
    3,
    4,
    5
   ],
   "y": [
    2.1,
    3.9,
    6.2,
    7.8,
    10.1
   ],
   "confidence_level": 0.95
  },
  "type": "http",
  "method": "POST",
  "bodyType": "json"
 }
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "x": {
   "anyOf": [
    {
     "type": "array",
     "items": {
      "type": "array",
      "items": {
       "type": "number"
      }
     }
    },
    {
     "type": "array",
     "items": {
      "type": "number"
     }
    }
   ],
   "title": "X",
   "description": "Independent variable(s): 1D array for simple, 2D for multiple regression"
  },
  "y": {
   "type": "array",
   "items": {
    "type": "number"
   },
   "title": "Y",
   "description": "Dependent variable array"
  },
  "confidence_level": {
   "type": "number",
   "title": "Confidence Level",
   "default": 0.95,
   "description": "Confidence level for intervals (e.g. 0.95 = 95%)"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-quantoracle-dev-c49af2df/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.quantoracle.dev](https://www.zero.xyz/host/api.quantoracle.dev/llms.txt)
