Regression coefficients check
regression-coefficients-check · version 1.0.0 · Numbers & math · free, no key needed
Check claimed least-squares regression coefficients against exact samples; reports rank and the first mismatch.
Use when you need to: verify least squares regression coefficients · check claimed linear regression fit exactly · is this regression line correct.
Decide before calling
Read the versioned contract and the supported scope below. Reuse regression-coefficients-check@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use regression-coefficients-check@1.0.0 for verify least squares regression coefficients. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- verify least squares regression coefficients
- check claimed linear regression fit exactly
- is this regression line correct
- validate ols coefficients from data
- check slope and intercept of a fitted line
- verify multiple regression coefficients exactly
- בדיקת מקדמי רגרסיה לינארית
Not supported
- weighted, ridge or robust regression
- p-values, standard errors or confidence intervals
- nonlinear models (use polynomial features as columns)
- approximate or tolerance-based comparison
Behavior
- Reference: NIST/SEMATECH e-Handbook of Statistical Methods sec. 4.1.4.1 and 4.4.3.1 (ordinary least squares, normal equations); exact rational arithmetic.
- Model (NIST e-Handbook 4.1.4.1): y_i = sum_j beta_j X_ij + e_i; X has a leading column of ones when intercept is true (required, no default), then the x features in order; coefficient 0 is the intercept when present.
- Values are exact strings: integer, decimal ("3.5") or fraction ("7/2"), never JSON numbers or exponents; comparisons are exact and outputs canonical reduced fractions. difference = claimed - actual.
- Ragged rows, len(y) != rows or empty x are invalid_input; a claimed vector of the wrong length is valid:false dimension_mismatch, checked first.
- Rank is exact; dependent_column is the first column of X that is a combination of earlier columns. rank < k (including fewer samples than columns) is singular_design: the least-squares coefficients are not unique.
- Check order: dimensions, then rank (singular_design; no coefficient is compared because the solution is ambiguous), then coefficients in index order (coefficient_mismatch). coefficients is the exact least-squares solution when rank = k, else null.
- Limits: 256 samples, 8 features, 30 digits per sample value, 1000 digits per claimed value, 9 claimed coefficients, 256 claimed residuals, and common denominators of at most 100 digits for the x values and for the y values and 1000 digits for the claimed coefficients; over a limit is limit_exceeded.
Input
x(array of array of string, required): min items 1; max items 256; each min items 1; each max items 8; each each pattern^-?(0|[1-9][0-9]*)(\.[0-9]+|/[1-9][0-9]*)?$y(array of string, required): min items 1; max items 256; each pattern^-?(0|[1-9][0-9]*)(\.[0-9]+|/[1-9][0-9]*)?$intercept(boolean, required)coefficients(array of string, required): max items 9; each pattern^-?(0|[1-9][0-9]*)(\.[0-9]+|/[1-9][0-9]*)?$
Output
valid(boolean, required)reason(one of null, "dimension_mismatch", "singular_design", "coefficient_mismatch", required)rank(integer, required): min 0coefficients(array or null, required)first_discrepancy(object or null, required)reference_version(constant "NIST/SEMATECH e-Handbook of Statistical Methods sec. 4.1.4.1 and 4.4.3.1 (ordinary least squares, normal equations); exact rational arithmetic", required)
Limits
- max samples: 256
- max features: 8
- max sample digits: 30
- max claim digits: 1000
- max data denominator digits: 100
- max claim denominator digits: 1000
Example
Request input:
{
"x": [
[
"1"
],
[
"2"
],
[
"3"
],
[
"4"
]
],
"y": [
"6",
"5",
"7",
"10"
],
"intercept": true,
"coefficients": [
"3.5",
"1.4"
]
}
Response:
{
"result": {
"valid": true,
"reason": null,
"rank": 2,
"coefficients": [
"7/2",
"7/5"
],
"first_discrepancy": null,
"reference_version": "NIST/SEMATECH e-Handbook of Statistical Methods sec. 4.1.4.1 and 4.4.3.1 (ordinary least squares, normal equations); exact rational arithmetic"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "regression-coefficients-check",
"version": "1.0.0",
"input": {
"x": [
[
"1"
],
[
"2"
],
[
"3"
],
[
"4"
]
],
"y": [
"6",
"5",
"7",
"10"
],
"intercept": true,
"coefficients": [
"3.5",
"1.4"
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/regression-coefficients-check/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"x":[["1"],["2"],["3"],["4"]],"y":["6","5","7","10"],"intercept":true,"coefficients":["3.5","1.4"]}'
The machine-readable contract is at /v1/tools/regression-coefficients-check/versions/1.0.0.
CLI
node cli.mjs run regression-coefficients-check 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Regression residuals check: Check claimed residuals and SSE for given regression coefficients and exact samples; reports the first wrong residual.
- Lp primal feasibility check: Check that a claimed LP point satisfies x >= 0 and Ax <= b exactly; report the first violated bound or row.
- Linear residual check: Check a claimed residual r = b - A x (per component and/or its max norm) exactly for an approximate solution x.
- Polynomial division check: Check a claimed polynomial division A = BQ + R over exact rationals: remainder degree, quotient degree, coefficients.
- Rational expression check: Check a claimed exact rational value of an integer/fraction expression; reports the true value and the difference.
- Regression normal equations check: Check that claimed coefficients and residuals satisfy X^T e = 0 exactly; rejects singular, ambiguous designs.