{"uid":"cap_sBeq7044jXI7yyFQ7dO5D","slug":"weighted-calibration-fit-linear-regression-3fa15e4b","name":"Weighted Calibration Fit (Linear Regression)","description":"Fit y = intercept + slope*x to 2–64 declared pairs using positive weights and exact rational normal equations. Returns residuals and weighted SSE rounded to 12 decimal places, plus finite float64 RMSE. Rejects degenerate X values; weights are not verified uncertainties. Not field certification.","url":"https://www.mahastrategies.com/api/v1/micro/weighted-calibration-fit?utm_source=zero.xyz","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":["dataClass","pairs"],"properties":{"pairs":{"type":"array","maxItems":64,"minItems":1},"dataClass":{"enum":["public","synthetic"],"type":"string"}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","required":["version","offerId","amountBaseUnits","inputDigest","result","boundaries","receiptDigest"],"properties":{"result":{"type":"object"},"offerId":{"enum":["weighted-calibration-fit"],"type":"string"},"version":{"enum":["maha-microproducts/0.1"],"type":"string"},"boundaries":{"type":"array","maxItems":128,"minItems":0},"inputDigest":{"type":"string","maxLength":71},"receiptDigest":{"type":"string","maxLength":71},"amountBaseUnits":{"enum":["26500"],"type":"string"}},"additionalProperties":false}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.0265","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"registry","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.0265/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0265","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0265","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_aD-Q9yfrOAgh3Ctn8rfW8","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.0265","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Fits a weighted linear model y = intercept + slope*x to 2–64 (x, y, weight) pairs using exact rational normal equations, returning fitted coefficients, residuals, and weighted SSE/RMSE.","exampleAgentPrompt":"Fit a weighted linear calibration curve to these 5 public data pairs: x=[1,2,3,4,5], y=[2.1,3.9,6.2,7.8,10.1], weights=[1.0,2.0,1.5,2.5,1.0] — give me the slope, intercept, residuals, and RMSE.","exampleUseCases":[{"title":"Instrument calibration curve fitting","prompt":"I have 8 calibration readings from my sensor with known precision weights — x=[0,10,20,30,40,50,60,70], y=[0.2,10.1,19.8,30.3,40.1,49.7,60.4,70.2], weights=[2,2,3,3,2,3,2,2] — fit a weighted linear model and give me the slope, intercept, and residuals so I can characterize the sensor."},{"title":"Quality control regression with weighted observations","prompt":"I have 6 synthetic quality-control data points where some measurements are more reliable than others: x=[5,10,15,20,25,30], y=[11.2,21.5,31.1,41.8,51.3,60.9], weights=[1,3,3,2,3,1]. Can you run a weighted least squares fit and report the RMSE and weighted SSE?"},{"title":"Analytical chemistry standard curve","prompt":"I'm building a standard curve for an assay using 4 public concentration-response pairs: x=[0.1,1.0,10.0,100.0], y=[0.05,0.48,4.93,49.7], weights=[1.5,2.0,2.0,1.0]. Fit a weighted linear regression and tell me the slope, intercept, and residuals rounded to 12 decimal places."}],"resultDescription":"Returns the fitted intercept and slope from weighted normal equations, an array of per-point residuals (observed minus fitted), the weighted sum of squared errors (SSE) rounded to 12 decimal places, and a finite float64 RMSE. Also includes offer metadata (offerId, version, inputDigest, receiptDigest, amountBaseUnits) and a boundaries array.","failureModes":["Fewer than 2 or more than 64 pairs provided — request rejected","Degenerate X values (all x identical, causing singular normal equations) — rejected with error","Non-positive weights cause rejection (weights must be positive)","Invalid dataClass enum value (must be 'public' or 'synthetic')","Payment not provided or insufficient USDC — x402 payment required","Malformed JSON body or missing required fields"],"whenToPreferThis":"Choose this endpoint when you need exact rational arithmetic weighted linear regression (y = intercept + slope*x) on small datasets (2–64 points) with per-point positive weights, and require residuals and SSE rounded to 12 decimal places with a finite RMSE. Prefer it over general-purpose statistics libraries when you need a deterministic, auditable microservice result with a receipt digest, or when operating in an agent pipeline that requires pay-per-call accountability via x402.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-20T06:46:15.371Z","isFirstParty":false,"canonicalSlug":"weighted-calibration-fit-linear-regression-3fa15e4b"}