Skip to content
Fourohtwo

agent402.tools/api/linear-regression

Fit a least-squares line y = slope·x + intercept to two equal-length series. Returns slope, intercept, r² (variance explained), and optionally predicted y values for new x inputs - useful for trend extrapolation (e.g. project next quarter's revenue from the last 8 quarters).

BasePolygonArbitrumMonadAvalancheSei+5Unchecked
POSThttps://agent402.tools/api/linear-regression

UptimeNot checked yet

30 days agoToday

Try it

Pays from your browser wallet in USDC on Base or USDG on Robinhood Chain, whichever the endpoint takes. The provider is paid directly; failed calls aren't refunded by Fourohtwo.

The response shows up here.

Call it from an agent

import { createPayer } from "fourohtwo";

// One agent key pays USDC on Base or USDG on Robinhood Chain,
// inside the spending rules you set on Fourohtwo.
const pay = createPayer({ privateKey: process.env.AGENT_KEY });
const res = await pay("https://agent402.tools/api/linear-regression", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"predict":[6,7],"x":[1,2,3,4,5],"y":[2.1,4,6.1,7.9,10.2]}),
});
console.log(await res.json());

Example input

{
  "predict": [
    6,
    7
  ],
  "x": [
    1,
    2,
    3,
    4,
    5
  ],
  "y": [
    2.1,
    4,
    6.1,
    7.9,
    10.2
  ]
}