{"uid":"cap_lYTVLkvZFIN1ZsVkYl9w2","slug":"saylor-innovations-data-desk-linear-regression-cd4362d3","name":"Saylor Innovations Data Desk – Linear Regression","description":"Linear regression on two lists - slope, intercept, r, r-squared, standard errors, p-value, 95% slope interval, equation and a prediction for a new x","url":"https://saylorinnovations.com/api/stats/regression?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["x","y"],"properties":{"x":{"type":"string","description":"Comma-separated x values, 3-500"},"y":{"type":"string","description":"Comma-separated y values, same count as x"},"predict_x":{"type":"string","description":"optional x to predict y for"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string","const":"json"},"example":{"type":"object","required":["n","slope","intercept","r_squared"],"properties":{"n":{"type":"number","description":"Number of points"},"r":{"type":"number","description":"Pearson correlation coefficient"},"slope":{"type":"number","description":"Change in y per unit of x"},"source":{"type":"string","description":"Data source the values come from"},"slope_t":{"type":["number","null"],"description":"Slope t"},"equation":{"type":"string","description":"Fitted line as text"},"intercept":{"type":"number","description":"Value of y when x is 0"},"r_squared":{"type":"number","description":"R squared"},"prediction":{"type":["object","null"],"properties":{"x":{"type":["number","null"],"description":"The x that was predicted for"},"y":{"type":["number","null"],"description":"Predicted y"},"extrapolated":{"type":["boolean","null"],"description":"True when x is outside the range of the data"}},"description":"Predicted y for predict_x and whether it extrapolates beyond the data"},"slope_95_ci":{"type":"array","description":"Slope 95 ci"},"slope_p_value":{"type":"number","description":"Slope p value"},"interpretation":{"type":"string","description":"Plain-language reading of the result"},"slope_std_error":{"type":["number","null"],"description":"Slope std error"},"residual_std_error":{"type":"number","description":"Residual std error"},"intercept_std_error":{"type":["number","null"],"description":"Intercept std error"}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","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.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_eykYATPjXjW_iDK6zLl5s","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Performs simple linear regression on two numeric lists, returning slope, intercept, R², p-value, standard errors, 95% confidence interval, fitted equation, and an optional prediction for a new x value","exampleAgentPrompt":"Run a linear regression on these x values [1,2,3,4,5,6,7,8,9,10] and y values [2.1,4.0,5.9,8.2,9.8,12.1,14.0,15.9,18.1,20.0], and also predict y when x is 12.","exampleUseCases":[{"title":"Sales trend and forecast","prompt":"I have monthly sales figures for the past year. X is [1,2,3,4,5,6,7,8,9,10,11,12] and Y is [5200,5450,5700,5800,6100,6350,6500,6700,7000,7200,7400,7600]. Can you run a linear regression and predict what sales will be in month 15?"},{"title":"Checking significance of a relationship","prompt":"I want to know if there's a statistically significant relationship between hours studied and test scores. Here are hours: [1,2,3,4,5,6,7,8] and scores: [55,60,65,70,72,78,85,90]. Give me the slope, p-value, and R-squared so I can see if it's meaningful."},{"title":"Break-even extrapolation for cost model","prompt":"Can you fit a regression line to my production cost data? Units produced are [100,200,300,400,500] and total costs are [1500,2200,2900,3700,4400]. I also need a cost prediction for 650 units — flag it if that's outside my data range."}],"resultDescription":"Returns a JSON object with: number of data points (n), slope, intercept, Pearson r, R-squared, slope standard error, slope t-statistic, slope p-value, 95% confidence interval for the slope as a two-element array, the fitted line as a human-readable equation string, a plain-language interpretation, and (if predict_x was supplied) a prediction object containing the input x, predicted y, and a boolean indicating whether the prediction extrapolates beyond the observed data range.","failureModes":["Mismatched x and y list lengths returns a 4xx validation error","Fewer than 3 data points triggers a minimum-count error","Non-numeric values in the comma-separated strings cause a parsing/validation error","Perfect collinearity or zero variance in x may produce infinite or null standard errors","predict_x outside data range returns a valid prediction but with extrapolated=true flag"],"whenToPreferThis":"Choose this endpoint when you need a complete, single-call simple linear regression with statistical significance testing (p-value, confidence interval) and optional point prediction, especially within an agent workflow where you want a structured JSON response plus a plain-language interpretation rather than running a stats library locally.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-27T19:25:48.237Z","isFirstParty":false,"canonicalSlug":"saylor-innovations-data-desk-linear-regression-cd4362d3"}