{"uid":"cap_QSIKkNB2ZBj-vF0ZhOXk6","slug":"least-squares-linear-fit-calculator-60e350be","name":"Least-Squares Linear Fit Calculator","description":"Least-squares linear fit calculator: pass paired numeric data and get back the best-fit line equation, slope, intercept, and goodness-of-fit score. For analytics dashboards, A/B result interpretation, and any pipeline that needs a quick, exact regression without spinning up a stats library.","url":"https://x402.forgemesh.io/least-squares-fit","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"x":{"type":"array","items":{"type":"number"}},"y":{"type":"array","items":{"type":"number"}}}},"responseSchema":{"type":"json","example":{"slope":1.9,"equation":"y = 1.9x + -0.5","intercept":-0.5,"r_squared":0.966}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","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.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_es5unhML5hwFfDt-LproT","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes the best-fit line for paired numeric data, returning slope, intercept, and R² goodness-of-fit score via least-squares regression.","exampleAgentPrompt":"Can you fit a least-squares line to these paired data points — x: [1, 2, 3, 4, 5] and y: [2.1, 3.9, 6.2, 7.8, 10.1] — and give me the slope, intercept, and R² score?","exampleUseCases":null,"resultDescription":"Returns the best-fit line equation parameters including slope, intercept, and a goodness-of-fit (R²) score indicating how well the line describes the data.","failureModes":["Mismatched array lengths between x and y (400 error)","Empty or single-element arrays that cannot produce a regression","Non-numeric values in x or y arrays","Vertical line data (zero variance in x) causing division by zero","Payment failure or insufficient USDC balance (402 error)"],"whenToPreferThis":"Choose this endpoint when you need a quick, exact least-squares linear regression without spinning up a local stats library or math environment — ideal for analytics dashboards, A/B test result interpretation, lightweight data pipelines, or any agent that needs slope/intercept/R² on the fly at low cost ($0.002 per call).","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T13:02:07.933Z","isFirstParty":false}