# Linear regression

`relate_linear_regression` · Runs: Built, not hosted · Level: Checked against a reference: R 4.4.3

Fits a linear regression.

From server 1.0.0 this tool is called stats\_linear\_regression. Until then it answers as relate\_linear\_regression.

Research and education software; not medical advice, and not for diagnosis or treatment decisions. It computes from the inputs it receives. It does not check the person's data, design or sample.

[Catalogue](https://www.drybench.com/mcp/catalogue) / [Statistics](https://www.drybench.com/mcp/catalogue/statistics)

[Ask your assistant](https://www.drybench.com/mcp/connect) · [Open in Drybench Assay](https://www.drybench.com/assay/app)

```cite
Linear regression (relate_linear_regression), Drybench MCP server 1.0.0; linear-regression-qr@1.0.1 (Checked against a reference); https://www.drybench.com/mcp/tools/relate-linear-regression
```

## What it is

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.

Field: [Statistics](https://www.drybench.com/mcp/catalogue/statistics). It is the same calculation as [Drybench Assay](https://www.drybench.com/assay/app), called by an AI assistant through the server.

## What it does

**You give**

- `unit` (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'.
- `x`: X per row, in its own unit; null for a blank.
- `y`: Y per row: a number, null (blank), or an array of replicate values for that row.
- `xLabel`: Optional name of X.
- `yLabel`: Optional name of Y.
- `origin`: Simple regression only: force regression through the origin (default false).

and 4 more, listed below

**A request and its answer**

Asked with

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

It answered (computed)

- `mode`: simple

Computed by this tool when the page was built. The steps between are not recorded, so this is not a worked example. The reply carries more values than are shown here. One answer to one request, not a reference value.

**Limits**

- 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.
- No other limit is recorded for this tool.

Every reply also carries its app's limits line: "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."

### Every input, with its units

10 inputs

- `unit` (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'.
- `x`: X per row, in its own unit; null for a blank.
- `y`: Y per row: a number, null (blank), or an array of replicate values for that row.
- `xLabel`: Optional name of X.
- `yLabel`: Optional name of Y.
- `origin`: Simple regression only: force regression through the origin (default false).
- `columns`: Multiple regression: response and predictor columns matched by row.
- `response`: Multiple regression: 0-based index of response column.
- `predictors`: Multiple regression: 2 to 10 distinct 0-based predictor column indexes.
- `level`: Confidence coverage level for intervals (0.9, 0.95 default, or 0.99).

## The calculation

The method's equations, constants and worked example.

### [Linear and multiple regression by QR, with pointwise bands](https://www.drybench.com/methods/m/linear-regression-qr/1.0.1)

`linear-regression-qr@1.0.1`

No equation is recorded for this version.

Kind of method: not recorded.

Worked example: not recorded for linear-regression-qr\@1.0.1.

## Sources

No source is recorded for this tool's methods.

Read by AI-assisted sessions. No person has checked these readings.

## How it is checked

**Level:** Checked against a reference.

**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).

**Cases:** No case set is linked to this version.

**Hostile inputs:** Sent 94 malformed, extreme and misspelt calls. None broke it, and every call with an undeclared argument, or with text in place of a number or a true/false value, was declined with a reason. Run 2026-11-12-2 of 12 November 2026, server 0.11.0.

**Same answer:** Called twice and with its arguments in another order, it gave the same result. Run 2026-11-12-2 of 12 November 2026, server 0.11.0.

**Not checked:** Not recorded. Its absence does not mean everything was checked.

No independent scientist has yet reviewed this.

### What this project's records still lack

5 things

- A case worked by hand from the source's equation for linear-regression-qr\@1.0.1.
- The equation for linear-regression-qr\@1.0.1.
- The constants with their sources for linear-regression-qr\@1.0.1.
- A case set linked to this version for linear-regression-qr\@1.0.1.
- A record of what was not checked for linear-regression-qr\@1.0.1.

### Cite a number from this tool

the cite line

Every reply carries a cite line naming the tool, the server version, each method with its version and level, and the receipt. Quote it with any number taken from the reply.

```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.
```

### Changes to its methods

1 change

- [21 November 2026, linear-regression-qr\@1.0.1](https://www.drybench.com/methods/corrections#2026-11-21-linear-regression-qr101-1): In 1.0.1 each X column and Y are divided by a power of two near their own largest absolute value before the fit, and every value reported in a unit is multiplied back (an intercept, SE, bound, σ, fitted value, residual and band by Y's power; a slope by Y's over its X's). t, p, R², F, VIF and leverage are unchanged by a positive scale of any column and a power of two scales a double exactly, so only inputs that overflowed or underflowed move: every probe case at 1e±160 and 1e±200 now gives the unscaled reply. A fit whose reported value cannot be represented (a slope of 1e400, say) is refused as BEYOND\_DOUBLE\_RANGE, and the lack-of-fit test is withheld so where its pure-error sum of squares cannot be.
