Source: https://guthlabs.ai/docs/instruments/regression-toolkit-linear-poly-exp-log/

instrument / verified-with-binding-errata

# Regression Toolkit (linear/poly/exp/log)

The current ledger marks this instrument verified with errata that must be applied at binding time.

Status: **VERIFIED_WITH_ERRATA**Lifecycle: **verified-with-binding-errata**

## Inspectable records

[01**Overview**Purpose and lifecycle](<https://guthlabs.ai/docs/instruments/regression-toolkit-linear-poly-exp-log/>)[02**Mechanism**Method and assumptions](<https://guthlabs.ai/docs/instruments/regression-toolkit-linear-poly-exp-log/mechanism/>)[03**Implementation**Binding and validation](<https://guthlabs.ai/docs/instruments/regression-toolkit-linear-poly-exp-log/implementation/>)[04**Qualification**Evidence and errata](<https://guthlabs.ai/docs/instruments/regression-toolkit-linear-poly-exp-log/qualification/>)

## Ledger state

The current ledger marks this instrument verified with errata that must be applied at binding time.

**Area**: Mathematics — arithmetic through advanced (algebra, matrices, calculus, sequences/series, number theory, combinatorics, graphing, complex numbers, geometry, logic, sets)

**Tranche**: tranche-8

**Evidence ID**: t8-038

**Ledger rows**: 1

No ledger note is attached.

## Review findings

The listed methods are standard only after the model forms, logarithm base, residual space, R² convention, polynomial degree, domain restrictions, and singular-fit behavior are specified. The exact ambiguity requiring review is whether exponential and power fits report transformed-space or original-space least-squares and R²; the specification also does not state the actual power-model formula.

### Formula and scope findings

- The normal-equation statement is correct for ordinary least squares, but the polynomial degree and coefficient ordering are unspecified.

- Exponential log-linearization is standard for fitting y=a*exp(bx) only when y>0; it minimizes squared residuals in ln(y), not generally squared residuals in y.

- Logarithmic fitting must specify whether the model is y=a+b*ln(x) or uses another logarithm base; x must be strictly positive.

- Power fitting is not explicitly parameterized; the standard model y=a*x^b requires x>0 and y>0 and log-linearizes to ln(y)=ln(a)+b*ln(x).

- R² is ambiguous for transformed exponential and power fits: it may mean R² in transformed log space or R² computed from residuals in the original y-space. These values are generally different.

- The residual-plot definition is unspecified, including whether residuals are y-observed minus y-predicted in original space or transformed space.

### Unit assumptions

- Linear and polynomial predictors and responses are numeric quantities in consistent units; coefficients inherit the corresponding units.

- For exponential models, x is treated as a numeric predictor and b has reciprocal-x units; y and fitted a must use the same response units.

- For logarithmic and power models, the logarithm argument must be dimensionless or normalized by a stated reference unit; the implementation appears to assume raw positive numeric x.

- Natural logarithms are assumed for all log-linearizations; changing the log base changes intermediate coefficients but not an exactly transformed fit if handled consistently.

- R² is assumed to be 1-SSE/SST using the same residual space as the reported fit, but the specification does not state whether that space is original or transformed.

## Boundary hardening

### Recorded hazards

- Normal equations become singular or ill-conditioned when predictors are collinear, polynomial degree is too high relative to the number or spread of observations, or there are insufficient data points.

- A linear fit needs at least two non-identical x values; a degree-d polynomial needs enough distinct, non-degenerate x values to make the design matrix full rank.

- Exponential fitting must reject or explicitly handle y<=0; logarithmic fitting must reject x<=0; power fitting must reject x<=0 and y<=0 under the stated log-linearization.

- Division by zero occurs when Sxx=0 for linear regression or when SST=0 for R²; the output policy for constant y is unspecified.

- Log transformation changes the objective and can create bias when predictions are back-transformed; a log-linearized fit is not generally the same as nonlinear least squares in original y-space.

- Large magnitudes, extreme polynomial degrees, and exponentials can overflow or suffer severe numerical conditioning problems; QR or SVD would generally be more stable than explicit normal equations.

- Residual plots need a stated residual convention and transformed-versus-original response space.

- The empty honest_label is a concern: the user-facing label should disclose domain restrictions, transformed-error fitting, R²-space ambiguity, and that power fitting is only listed in computes but not parameterized in formulas.

## Errata and corrections

### Tranche errata

**coefficients.slope / intercept / predicted_y / residuals** · vector 1

slope=3, intercept=-8/3

slope=3/2, intercept=1/3

own working computes Sxy=3 and Sxx=2 correctly, then writes "b=Sxy/Sxx=3" — omitting the division by Sxx=2 entirely; every downstream field (predictions, residuals) inherits the error

## Inspectable example

4 review vectors are recorded. One source-bound sample is shown below.

````
{
  "inputs": {
    "model_type": "linear",
    "data": [
      [
        1,
        2
      ],
      [
        2,
        3
      ],
      [
        3,
        5
      ]
    ],
    "residual_definition": "observed_minus_predicted"
  },
  "expected_outputs": {
    "coefficients": {
      "intercept": "-8/3",
      "slope": "3"
    },
    "predicted_y": [
      "1/3",
      "10/3",
      "19/3"
    ],
    "residuals": [
      "5/3",
      "-1/3",
      "-4/3"
    ],
    "R2": "0",
    "prediction_at_x_4": "28/3"
  },
  "reference_data": {
    "model": "y=a+bx",
    "R2_definition": "1-SSE/SST in original y-space"
  },
  "working": "x̄=(1+2+3)/3=2. ȳ=(2+3+5)/3=10/3. Sxx=(1-2)^2+(2-2)^2+(3-2)^2=2. Sxy=(1-2)(2-10/3)+(2-2)(3-10/3)+(3-2)(5-10/3)=4/3+5/3=3. Therefore b=Sxy/Sxx=3 and a=ȳ-bx̄=10/3-6=-8/3. Predictions are 3(1)-8/3=1/3, 3(2)-8/3=10/3, and 3(3)-8/3=19/3. Residuals are 2-1/3=5/3, 3-10/3=-1/3, and 5-19/3=-4/3. SSE=(25+1+16)/9=42/9=14/3. SST=(16+1+25)/9=42/9=14/3. R²=1-(14/3)/(14/3)=0. At x=4, ŷ=12-8/3=28/3."
}
````

## Related workflows

No source-defined multi-instrument workflow membership is recorded.

## Sources and evidence

These pointers bind the page to evidence. They do not grant authority or collapse verification into deployment.

- `VERIFIED_LEDGER.json · VERIFIED_WITH_ERRATA`

- `evidence-tranche8/tranche8-results.json`
