{"uid":"cap_EYSuoQTQDnlxFD4QbBhxv","slug":"dataforge-linear-regression-api-8c15dd6d","name":"DataForge Linear Regression API","description":"Low-cost statistical and analytical micro-APIs for agents and operations workflows.","url":"https://dataforge-production-ba33.up.railway.app/api/linear-regression?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"x":{"type":"array","items":{"type":"number"}},"y":{"type":"array","items":{"type":"number"}},"points":{"type":"array","items":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}}}}}},"responseSchema":{"type":"json","example":{"r":0.999,"r2":0.998,"slope":2.03,"intercept":-0.03}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","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.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_EyNZ0tUcd9x0o9oIPZohG","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","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 points and returns slope, intercept, and R² correlation statistics","exampleAgentPrompt":"Can you run a linear regression on this dataset — x values are [1, 2, 3, 4, 5] and y values are [2.1, 3.9, 6.2, 7.8, 10.1] — and tell me the slope, intercept, and R-squared?","exampleUseCases":[{"title":"Sales trend line for forecasting","prompt":"I have monthly sales figures for the past 12 months — x is month number 1 through 12 and y is [4200, 4400, 4800, 5100, 5300, 5600, 5900, 6100, 6400, 6700, 7000, 7300]. Can you fit a linear regression and tell me the slope, intercept, and R-squared so I can see how consistently we're growing?"},{"title":"Experimental data correlation check","prompt":"We ran a lab experiment and got these paired measurements — x: [0.5, 1.0, 1.5, 2.0, 2.5, 3.0] and y: [1.1, 2.3, 3.0, 4.1, 5.2, 6.0]. Can you do a linear regression and tell me the slope, intercept, and R² to see how well the relationship holds?"},{"title":"Ad spend vs. conversions analysis","prompt":"I want to understand how ad spend drives conversions. Here are my weekly numbers — ad spend x: [500, 750, 1000, 1250, 1500, 2000] and conversions y: [23, 31, 44, 58, 67, 89]. Run a linear regression and give me the slope, intercept, and R-squared."}],"resultDescription":"Returns a JSON object with four fields: slope (rate of change of y per unit x), intercept (y-axis crossing point of best-fit line), r (Pearson correlation coefficient), and r2 (coefficient of determination indicating proportion of variance explained). Values are floating-point numbers.","failureModes":["Mismatched array lengths between x and y cause a 400 error","Fewer than two data points provided — regression is undefined","Non-numeric values in arrays cause parsing or validation errors","Payment not included or insufficient — 402 Payment Required response","Empty arrays or null inputs return an error"],"whenToPreferThis":"Choose this endpoint when you need fast, cheap linear regression statistics (slope, intercept, R, R²) for pairs of numeric arrays without setting up a local data science environment. At $0.005 per call it is ideal for agent workflows, automation pipelines, or operational dashboards that need statistical summaries on demand. Prefer this over a general-purpose compute service when the input is already clean numeric arrays and you only need simple linear fit statistics.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-14T21:40:22.191Z","isFirstParty":false,"canonicalSlug":"dataforge-linear-regression-api-8c15dd6d"}