{"uid":"cap_vy7IIbe15BGALEeyBanZF","slug":"openverbs-linear-regression-2f1b07ae","name":"OpenVerbs Linear Regression","description":"Ordinary-least-squares linear regression of y on x: slope, intercept, correlation r and coefficient of determination r². Pass predictAt to also evaluate the fitted line at a given x. Rejected as a clean 400 if lengths differ or x has zero variance.","url":"https://stats.openverbs.com/v1/regression","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["x","y"],"properties":{"x":{"type":"array","items":{"type":"number"},"maxItems":100000,"minItems":2,"description":"Independent variable."},"y":{"type":"array","items":{"type":"number"},"maxItems":100000,"minItems":2,"description":"Dependent variable (same length as x)."},"predictAt":{"type":"number","description":"Optional x at which to evaluate the fitted line."}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.004","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.004/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_CnB-3RQJP_3byZ_Y_PUWv","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.004","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Fits a simple linear regression to paired x/y data arrays and optionally predicts y at a given x value","exampleAgentPrompt":"Can you fit a linear regression to my data — x is [1, 2, 3, 4, 5] and y is [2.1, 3.9, 6.2, 7.8, 10.1] — and predict what y would be at x = 6?","exampleUseCases":[{"title":"Sales trend forecasting","prompt":"I have monthly sales figures for the last 12 months. Can you fit a linear regression to this data and predict next month's sales? x is [1,2,3,4,5,6,7,8,9,10,11,12] and y is [4200,4500,4700,5100,5300,5600,5900,6100,6400,6700,6900,7200], predict at x=13."},{"title":"Physics experiment curve fitting","prompt":"I ran an experiment measuring distance over time and got these readings: time x=[0,1,2,3,4,5] seconds, distance y=[0.0,9.8,19.6,29.5,39.3,49.1] meters. Fit a linear model and tell me the slope and intercept."},{"title":"House price vs size estimation","prompt":"I have square footage and prices for 6 houses: sizes are [800,1000,1200,1500,1800,2100] and prices are [150000,185000,220000,275000,330000,390000]. Run a linear regression and estimate the price for a 1600 sq ft house."}],"resultDescription":"Returns the fitted linear regression parameters including slope, intercept, and R-squared (goodness-of-fit). If predictAt is provided, also returns the predicted y value at that x coordinate. The result enables the caller to understand the linear relationship between the two variables and make point predictions.","failureModes":["x and y arrays of different lengths — validation error returned","fewer than 2 data points provided — minimum constraint violated","non-numeric values in x or y arrays — schema validation failure","arrays exceeding 100,000 items — maxItems constraint rejection","payment not provided or insufficient — 402 Payment Required","perfectly vertical data (all x values identical) — undefined slope / division-by-zero error"],"whenToPreferThis":"Choose this endpoint when you need a quick, serverless linear regression computation without standing up your own statistical environment. It is ideal for simple bivariate relationships where a straight-line fit is appropriate, especially when you also want a point prediction at a specific x value. Prefer it over general-purpose compute endpoints when you want a clean, purpose-built statistical API that accepts raw numeric arrays directly.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T00:31:35.612Z","isFirstParty":false}