# Linear regression

`relate_linear_regression` is a tool of the Drybench MCP server. It runs the same engine and reporting rules as Drybench Assay.

## What it answers

Required: unit (unspecified, replicates, rows, serial, technical). Fits QR linear regression. Simple mode takes x and y (optional origin true compares against free fit); multiple mode takes columns, response, and predictors (complete cases). Inference opens only for replicate or row units; REGRESSION\_X\_NO\_SPREAD, REGRESSION\_N\_TOO\_SMALL, REGRESSION\_RANK\_DEFICIENT, or BEYOND\_DOUBLE\_RANGE return status refused.

The reply's result carries these fields (each measured number carries its unit, or a withheld notice when a rule applies):

- `fit` (object, required): when mode is simple
  - `n` (integer, unit `1`, required)
  - `origin` (boolean, required)
  - `intercept` (object, optional)
    - `estimate` (number, unit `as-given`, required)
    - `se` (number, unit `as-given`, required, or withheld)
    - `inference` (object, required, or withheld)
  - `slopes` (array of object, required)
    - `estimate` (number, unit `as-given`, required)
    - `se` (number, unit `as-given`, required, or withheld)
    - `inference` (object, required, or withheld)
  - `r2` (object, required, or withheld)
    - `value` (number, unit `1`, required)
    - `exact` (boolean, required)
  - `adjR2` (number, unit `1`, required, or withheld)
  - `sigma` (object, required, or withheld)
    - `value` (number, unit `as-given`, required)
    - `df` (integer, unit `1`, required)
  - `f` (object, optional, or withheld)
    - `value` (number, unit `1`, required)
    - `df1` (integer, unit `1`, required)
    - `df2` (integer, unit `1`, required)
    - `p` (number, unit `1`, required)
  - `vif` (array of number in `1`, optional)
    - `value` (number, required)
    - `unit` (`1`, required)
    - `level` (string, required)
  - `inferential` (boolean, required)
  - `closed` (optional): One of `UNIT_NOT_INDEPENDENT`, `SERIAL_READS`, `N_TOO_SMALL`, `ZERO_VARIANCE`, `ZERO_VARIANCE_GROUP`, `PAIR_INCOMPLETE`, `CELL_REFUSED`, `SPEARMAN_CI_N`, `SPEARMAN_CI_REGION`, `SPEARMAN_CI_LEVEL`, `PERFECT_CORRELATION`, `X_NO_SPREAD`, `Y_NO_SPREAD`, `EXACT_FIT`, `RANK_DEFICIENT`, `R2_ORIGIN`, `LOF_NO_REPLICATES`, `LEVERAGE_ONE`, `ROW_INCOMPLETE`, `NONPOSITIVE_X`, `BEFORE_X0`, `NO_POSITIVE_Y`, `NOT_CONVERGED`, `AT_BOUND`, `NOT_IDENTIFIED`, `RATES_NOT_SEPARATED`, `PHASE_VANISHES`, `FAST_PHASE_UNSAMPLED`, `PLATEAU_NOT_REACHED`, `PLATEAU_NOT_BRACKETED`, `NO_TRANSITION`, `MIDPOINT_AT_EDGE`, `DESIGN_ILL_CONDITIONED`, `ZERO_RESIDUAL`, `NOT_FITTED`, `AICC_N`, `RSS_AT_ZERO`, `DATA_MISMATCH`, `SAME_FUNCTION_MISMATCH`, `DOMAIN`, `WEIGHTED_HELD`, `TRANSFORMED_RESPONSE`, `UNITS_NOT_SAME`, `NO_COVARIANCE`, `PERFECT_FIT`, `LAMBDA_INVALID`, `REPLICATES_UNBALANCED`, `REPLICATE_SD_ZERO`, `JACKKNIFE_DEGENERATE`, `OUTSIDE_RANGE`, `NONPOSITIVE_VALUES`, `ZERO_DIFFERENCE_SD`, `SW_N_RANGE`, `BEYOND_DOUBLE_RANGE`.
  - `diagnostics` (object, required)
    - `fitted` (array of number in `as-given`, required)
    - `residuals` (array of number in `as-given`, required)
    - `leverage` (array of number in `1`, required)
    - `standardised` (array, required)
    - `cooks` (array, required)
    - `qq` (object, required)
    - `highLeverage` (array of integer, required)
- `mode` (`simple`, required): when mode is simple
- `points` (object, required): when mode is simple
  - `count` (integer, unit `1`, required)
  - `means` (boolean, required)
  - `shortRows` (array of object, required)
    - `row` (integer, required)
    - `count` (integer, unit `1`, required)
    - `of` (integer, unit `1`, required)
  - `dropped` (array of object, required)
    - `row` (integer, required)
    - `side` (string, required)
    - `status` (string, optional)
    - `column` (string, optional)
    - `yDropped` (integer, unit `1`, optional)
    - `reasons` (array of object, optional)
- `replicates` (array of integer in `1`, optional): when mode is simple
  - `value` (integer, required)
  - `unit` (`1`, required)
- `free` (object, optional): when mode is simple
  - `n` (integer, unit `1`, required)
  - `origin` (boolean, required)
  - `intercept` (object, optional)
    - `estimate` (number, unit `as-given`, required)
    - `se` (number, unit `as-given`, required, or withheld)
    - `inference` (object, required, or withheld)
  - `slopes` (array of object, required)
    - `estimate` (number, unit `as-given`, required)
    - `se` (number, unit `as-given`, required, or withheld)
    - `inference` (object, required, or withheld)
  - `r2` (object, required, or withheld)
    - `value` (number, unit `1`, required)
    - `exact` (boolean, required)
  - `adjR2` (number, unit `1`, required, or withheld)
  - `sigma` (object, required, or withheld)
    - `value` (number, unit `as-given`, required)
    - `df` (integer, unit `1`, required)
  - `f` (object, optional, or withheld)
    - `value` (number, unit `1`, required)
    - `df1` (integer, unit `1`, required)
    - `df2` (integer, unit `1`, required)
    - `p` (number, unit `1`, required)
  - `vif` (array of number in `1`, optional)
    - `value` (number, required)
    - `unit` (`1`, required)
    - `level` (string, required)
  - `inferential` (boolean, required)
  - `closed` (optional): One of `UNIT_NOT_INDEPENDENT`, `SERIAL_READS`, `N_TOO_SMALL`, `ZERO_VARIANCE`, `ZERO_VARIANCE_GROUP`, `PAIR_INCOMPLETE`, `CELL_REFUSED`, `SPEARMAN_CI_N`, `SPEARMAN_CI_REGION`, `SPEARMAN_CI_LEVEL`, `PERFECT_CORRELATION`, `X_NO_SPREAD`, `Y_NO_SPREAD`, `EXACT_FIT`, `RANK_DEFICIENT`, `R2_ORIGIN`, `LOF_NO_REPLICATES`, `LEVERAGE_ONE`, `ROW_INCOMPLETE`, `NONPOSITIVE_X`, `BEFORE_X0`, `NO_POSITIVE_Y`, `NOT_CONVERGED`, `AT_BOUND`, `NOT_IDENTIFIED`, `RATES_NOT_SEPARATED`, `PHASE_VANISHES`, `FAST_PHASE_UNSAMPLED`, `PLATEAU_NOT_REACHED`, `PLATEAU_NOT_BRACKETED`, `NO_TRANSITION`, `MIDPOINT_AT_EDGE`, `DESIGN_ILL_CONDITIONED`, `ZERO_RESIDUAL`, `NOT_FITTED`, `AICC_N`, `RSS_AT_ZERO`, `DATA_MISMATCH`, `SAME_FUNCTION_MISMATCH`, `DOMAIN`, `WEIGHTED_HELD`, `TRANSFORMED_RESPONSE`, `UNITS_NOT_SAME`, `NO_COVARIANCE`, `PERFECT_FIT`, `LAMBDA_INVALID`, `REPLICATES_UNBALANCED`, `REPLICATE_SD_ZERO`, `JACKKNIFE_DEGENERATE`, `OUTSIDE_RANGE`, `NONPOSITIVE_VALUES`, `ZERO_DIFFERENCE_SD`, `SW_N_RANGE`, `BEYOND_DOUBLE_RANGE`.
  - `diagnostics` (object, required)
    - `fitted` (array of number in `as-given`, required)
    - `residuals` (array of number in `as-given`, required)
    - `leverage` (array of number in `1`, required)
    - `standardised` (array, required)
    - `cooks` (array, required)
    - `qq` (object, required)
    - `highLeverage` (array of integer, required)
- `bands` (object, required): when mode is simple
  - `level` (string, required)
  - `points` (array of object, required)
    - `x` (number, unit `as-given`, required)
    - `fit` (number, unit `as-given`, required)
    - `confidence` (object, optional)
    - `prediction` (object, optional)
- `lackOfFit` (object, required, or withheld): when mode is simple
  - `f` (number, unit `1`, required)
  - `df1` (integer, unit `1`, required)
  - `df2` (integer, unit `1`, required)
  - `p` (number, unit `1`, required)
  - `pureError` (number, unit `as-given`, required)
  - `distinct` (integer, unit `1`, required)
- `fit` (object, required): when mode is multiple
  - `n` (integer, unit `1`, required)
  - `origin` (boolean, required)
  - `intercept` (object, optional)
    - `estimate` (number, unit `as-given`, required)
    - `se` (number, unit `as-given`, required, or withheld)
    - `inference` (object, required, or withheld)
  - `slopes` (array of object, required)
    - `estimate` (number, unit `as-given`, required)
    - `se` (number, unit `as-given`, required, or withheld)
    - `inference` (object, required, or withheld)
  - `r2` (object, required, or withheld)
    - `value` (number, unit `1`, required)
    - `exact` (boolean, required)
  - `adjR2` (number, unit `1`, required, or withheld)
  - `sigma` (object, required, or withheld)
    - `value` (number, unit `as-given`, required)
    - `df` (integer, unit `1`, required)
  - `f` (object, optional, or withheld)
    - `value` (number, unit `1`, required)
    - `df1` (integer, unit `1`, required)
    - `df2` (integer, unit `1`, required)
    - `p` (number, unit `1`, required)
  - `vif` (array of number in `1`, optional)
    - `value` (number, required)
    - `unit` (`1`, required)
    - `level` (string, required)
  - `inferential` (boolean, required)
  - `closed` (optional): One of `UNIT_NOT_INDEPENDENT`, `SERIAL_READS`, `N_TOO_SMALL`, `ZERO_VARIANCE`, `ZERO_VARIANCE_GROUP`, `PAIR_INCOMPLETE`, `CELL_REFUSED`, `SPEARMAN_CI_N`, `SPEARMAN_CI_REGION`, `SPEARMAN_CI_LEVEL`, `PERFECT_CORRELATION`, `X_NO_SPREAD`, `Y_NO_SPREAD`, `EXACT_FIT`, `RANK_DEFICIENT`, `R2_ORIGIN`, `LOF_NO_REPLICATES`, `LEVERAGE_ONE`, `ROW_INCOMPLETE`, `NONPOSITIVE_X`, `BEFORE_X0`, `NO_POSITIVE_Y`, `NOT_CONVERGED`, `AT_BOUND`, `NOT_IDENTIFIED`, `RATES_NOT_SEPARATED`, `PHASE_VANISHES`, `FAST_PHASE_UNSAMPLED`, `PLATEAU_NOT_REACHED`, `PLATEAU_NOT_BRACKETED`, `NO_TRANSITION`, `MIDPOINT_AT_EDGE`, `DESIGN_ILL_CONDITIONED`, `ZERO_RESIDUAL`, `NOT_FITTED`, `AICC_N`, `RSS_AT_ZERO`, `DATA_MISMATCH`, `SAME_FUNCTION_MISMATCH`, `DOMAIN`, `WEIGHTED_HELD`, `TRANSFORMED_RESPONSE`, `UNITS_NOT_SAME`, `NO_COVARIANCE`, `PERFECT_FIT`, `LAMBDA_INVALID`, `REPLICATES_UNBALANCED`, `REPLICATE_SD_ZERO`, `JACKKNIFE_DEGENERATE`, `OUTSIDE_RANGE`, `NONPOSITIVE_VALUES`, `ZERO_DIFFERENCE_SD`, `SW_N_RANGE`, `BEYOND_DOUBLE_RANGE`.
  - `diagnostics` (object, required)
    - `fitted` (array of number in `as-given`, required)
    - `residuals` (array of number in `as-given`, required)
    - `leverage` (array of number in `1`, required)
    - `standardised` (array, required)
    - `cooks` (array, required)
    - `qq` (object, required)
    - `highLeverage` (array of integer, required)
- `mode` (`multiple`, required): when mode is multiple
- `rows` (object, required): when mode is multiple
  - `columns` (array of array, required)
  - `rows` (array of integer, required)
  - `dropped` (array of object, required)
    - `row` (integer, required)
    - `side` (string, required)
    - `status` (string, optional)
    - `column` (string, optional)
    - `yDropped` (integer, unit `1`, optional)
    - `reasons` (array of object, optional)
- `names` (array of string, required): when mode is multiple
- `yName` (string, required): when mode is multiple

**Limits:**

- n counts points from units you declared independent; the intervals and p-values assume independent, constant-variance errors and cannot check either. The fit describes these data over the X range supplied, and a coefficient describes association, not what would happen if X were changed.
- It computes from the inputs it receives. It does not check the person's data, design or sample.
- Every computed number a reply returns, other than an integer or an exact decimal, is rounded once to 12 significant figures: to the nearest, a change of at most 5 × 10⁻¹² of its value, except that a lower bound is rounded down and an upper bound up, a change of less than 1 × 10⁻¹¹; the method computes, and decides any pass or fail, on the unrounded value.

> Research and education software; not for diagnosis or treatment decisions.
>
> Not medical advice. Nothing here is advice about any medicine, treatment or condition, and nothing here is an assessment of any person's variant, sample or molecule. Decisions made with it are yours.
>
> Not a forecast. Stages, scores, rates, rankings and similarities shown here describe records as they stand, or historical averages; they are not a forecast for any molecule, trial, drug, company or target.

## What this page can and cannot show

Weakest level among this tool's methods: Checked against a reference. Reference kind not recorded for 1 of 1 methods.

Not fully recorded, and not independently reviewed. Items marked "Not recorded" are missing from this project's records for the version named. Apart from any worked example shown, the cases and their values are not printed, so a reader cannot re-run these checks. No independent scientist has yet reviewed these methods or checks.

[Open Drybench Assay](https://www.drybench.com/assay/app) · [Drybench Assay: methods and checks](https://www.drybench.com/methods/assay) · [What the levels mean](https://www.drybench.com/methods/levels) · [Every assistant tool](https://www.drybench.com/methods/tools)

## Inputs

An omitted input takes the default its description states; the reply's `inputsReceived` shows what was given. Any input not listed here is refused.

- `x` (array of number or null, optional): X per row, in its own unit; null for a blank.
- `y` (array of number or null or array, optional): Y per row: a number, null (blank), or an array of replicate values for that row.
- `xLabel` (string, optional): Optional name of X.
- `yLabel` (string, optional): Optional name of Y.
- `origin` (boolean, optional): Simple regression only: force regression through the origin (default false).
- `columns` (array of object, optional): Multiple regression: response and predictor columns matched by row.
  - `name` (string, optional): Optional column name (defaults to A, B, C...).
  - `values` (array of number or null, required): Column numeric entries (null for blank cells).
  - `excludedRows` (array of integer, optional): 1-based row numbers to keep excluded.
- `response` (integer, optional): Multiple regression: 0-based index of response column.
- `predictors` (array of integer, optional): Multiple regression: 2 to 10 distinct 0-based predictor column indexes.
- `unit` (string, required): What one point is (required; never inferred): 'replicates' (each replicate an independent unit), 'rows' (each row an independent unit, replicates technical: row means are used), 'serial' (serial reads of one unit), 'technical', or 'unspecified'. Inference needs 'replicates' or 'rows'. One of `unspecified`, `replicates`, `rows`, `serial`, `technical`.
- `level` (number, optional): Confidence coverage level for intervals (0.9, 0.95 default, or 0.99). One of `0.9`, `0.95`, `0.99`.

## What it withholds or refuses

A refusal, a withheld value or another named status is an answer: the reply gives the reason and no number in its place; an absent value is not zero. Invalid input means nothing ran.

Refusal codes: not recorded for relate\_linear\_regression.

Values it withholds: not recorded for relate\_linear\_regression.

## How to cite a number from it

Every reply carries a cite line. It names, in order: the tool and the server version; each method the call went through, with its version and level (and the limit beside a level where the method's record narrows it); the receipt, the first 12 characters of the hashes of the arguments and of the result; and the address where its methods are described. Quote it with any number taken from the reply.

The receipt identifies a computation; it is not a signature. It holds no time, so the same arguments on the same server and method versions give the same receipt, and anyone can call the tool again and compare; a later method version can change the output hash.

### An example

The values asked and the values answered, computed by this tool when this page was built:

**Asked with**

- `xLabel`: Protein (ug)
- `yLabel`: Signal
- `origin`: no
- `unit`: rows
- `level`: 0.95

It answered (`computed`):

- `mode`: simple

The reply carries more values than are shown here.

Its cite line:

```cite
relate_linear_regression, server 1.0.0; linear-regression-qr@1.0.1 (Checked against a reference); receipt 3c422490c8ce/f16ab418fdaa; methods https://www.drybench.com/methods/assay; page https://www.drybench.com/methods/tools/relate-linear-regression. Quote this line with any number taken from this reply.
```

## Methods

Every method and reference the tool's replies cite, with its version and level. A reply names the methods that call went through.

### Linear and multiple regression by QR, with pointwise bands

- **Method:** `linear-regression-qr@1.0.1`
- **Level:** Checked against a reference. Reference kind: not recorded. This level uses the apps' wider definition on the levels page.
- **Reference:** Golub GH, Van Loan CF. Matrix computations, 4th ed. 2013, §5.2-5.3 (Householder QR); Draper NR, Smith H. Applied regression analysis, 3rd ed. 1998 (lack of fit, pointwise bands).
- **How it was checked:** Checked against R 4.4.3 (lm, summary.lm, confint, predict.lm, hatvalues, rstandard, cooks.distance, car 3.1-5 vif and the lack-of-fit anova) on the 27 regression cases of the 0.11.0 fixture (21 simple, 6 multiple; 2 ill-conditioned cases against exact rational least squares): coefficients, standard errors, t, bounds, R², the residual SD, hat values, standardised residuals, Cook's distance, VIF, the bands and the lack-of-fit F within 1e-9 relative, p within 1e-8 relative, refusals, aliased predictors and withheld states exact; SciPy 1.13.1 linregress agrees on all 19 slopes it computes (2026-10-13).
- What was not checked: not recorded for linear-regression-qr\@1.0.1. Its absence does not mean everything was checked.
- [Method, sources and checks](https://www.drybench.com/methods/m/linear-regression-qr)
- [On Drybench Assay's methods page: Correlation](https://www.drybench.com/methods/assay#correlation)

No independent scientist has yet reviewed these checks. [What the levels mean](https://www.drybench.com/methods/levels).

## Changes to its methods

- [2026-11-21 · linear-regression-qr\@1.0.1](https://www.drybench.com/methods/corrections#2026-11-21-linear-regression-qr101-1)

## Where it runs

The local MCP server serves this tool; the hosted MCP connection does not.

## Methods and checks

- [Drybench Assay: methods and checks](https://www.drybench.com/methods/assay)
- [Reference checks: Drybench Assay](https://www.drybench.com/methods/assay/checks)
- [What the levels mean](https://www.drybench.com/methods/levels)
- [Every assistant tool](https://www.drybench.com/methods/tools)
