Overview
- Category
- Math
- API mode
not_available- Processing
- client-side
- Privacy
- no-data-stored
Public descriptor
The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.
GET /api/v1/tools/linear-regression-calculator
Execute availability
This tool is documented as a browser capability. Its execute route does not produce a server-side result; when execution is enabled, it responds with browser_interaction_required and points callers to the public tool page.
POST /api/v1/tools/linear-regression-calculator/execute
Authentication is not issued during the preview. A bearer API key is planned for execution after launch.
Input schema
object object; additional properties are not accepted.
x_values· string · required- Enter the x values used by this tool.
y_values· string · required- Enter the y values used by this tool.
prediction_x· number · required- Enter the x value to predict used by this tool.
{
"type": "object",
"properties": {
"x_values": {
"type": "string",
"description": "Enter the x values used by this tool."
},
"y_values": {
"type": "string",
"description": "Enter the y values used by this tool."
},
"prediction_x": {
"type": "number",
"description": "Enter the x value to predict used by this tool."
}
},
"required": [
"x_values",
"y_values",
"prediction_x"
],
"additionalProperties": false
}
Output schema
On a successful execution, schema values appear in data.result.values.
equation· string- Regression equation produced by the tool.
slope· number- Slope produced by the tool.
intercept· number- Intercept produced by the tool.
r_squared· number- R-squared produced by the tool.
predicted_y· number- Predicted y produced by the tool.
points· array- Regression points produced by the tool.
{
"type": "object",
"properties": {
"equation": {
"type": "string",
"description": "Regression equation produced by the tool."
},
"slope": {
"type": "number",
"description": "Slope produced by the tool."
},
"intercept": {
"type": "number",
"description": "Intercept produced by the tool."
},
"r_squared": {
"type": "number",
"description": "R-squared produced by the tool."
},
"predicted_y": {
"type": "number",
"description": "Predicted y produced by the tool."
},
"points": {
"type": "array",
"description": "Regression points produced by the tool."
}
},
"additionalProperties": false
}
Linear Regression Calculator example
The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.
curl -X POST "https://utilitypages.org/api/v1/tools/linear-regression-calculator/execute" \
-H "Content-Type: application/json" \
-d '{
"x_values": "1, 2, 3, 4, 5",
"y_values": "2.1, 4.2, 5.8, 8.1, 10.2",
"prediction_x": 6
}'
{
"ok": true,
"data": {
"slug": "linear-regression-calculator",
"result": {
"values": {
"equation": "y = 2.01x + 0.05",
"slope": 2.0099999999999997868371792719699442386627197265625,
"intercept": 0.05000000000000000277555756156289135105907917022705078125,
"r_squared": 0.99735854645999999501526644962723366916179656982421875,
"predicted_y": 12.1099999999999994315658113919198513031005859375,
"points": [
{
"x": 1,
"y": 2.100000000000000088817841970012523233890533447265625,
"fitted_y": 2.060000000000000053290705182007513940334320068359375,
"residual": 0.040000000000000000832667268468867405317723751068115234375
},
{
"x": 2,
"y": 4.20000000000000017763568394002504646778106689453125,
"fitted_y": 4.07000000000000028421709430404007434844970703125,
"residual": 0.13000000000000000444089209850062616169452667236328125
},
{
"x": 3,
"y": 5.79999999999999982236431605997495353221893310546875,
"fitted_y": 6.0800000000000000710542735760100185871124267578125,
"residual": -0.2800000000000000266453525910037569701671600341796875
},
{
"x": 4,
"y": 8.0999999999999996447286321199499070644378662109375,
"fitted_y": 8.089999999999999857891452847979962825775146484375,
"residual": 0.01000000000000000020816681711721685132943093776702880859375
},
{
"x": 5,
"y": 10.199999999999999289457264239899814128875732421875,
"fitted_y": 10.0999999999999996447286321199499070644378662109375,
"residual": 0.1000000000000000055511151231257827021181583404541015625
}
]
},
"display": {
"display": "y = 2.01x + 0.05"
},
"warnings": [],
"assumptions": [],
"steps": []
}
},
"meta": [],
"request_id": "req_example_123"
}
Errors
api_not_launched· 503- Returned by the current launch gate for every execute request.
invalid_json· 400- Returned when an enabled execute request does not contain valid JSON.
validation_failed· 422- Returned when a request does not satisfy the input schema.
browser_interaction_required· 422- Returned for browser capability tools instead of inventing a server-side result.
tool_not_found· 404- Returned when a requested descriptor slug does not exist.
execution_failed· 503- Returned when an enabled server-side execution cannot complete.