R operation reference
Generated from the current declarations. Do not edit this file by hand.
Types, limits and defaults below describe resolved values. Runtime expressions must produce these types. Unknown options are rejected; defaults apply only when omitted. Constructor options must be constant after document composition.
Index#
linearRegression#
Fits an ordinary least-squares linear model (response = intercept + sum of coefficient x predictor) to 1 to 8 numeric predictors with R's stats::lm, then reopens the saved model in a fresh R process and checks every coefficient, prediction and residual against an independent calculation. It publishes coefficients.csv, training.csv, heldout.csv (when held-out rows are given), regression-summary.json and, with optional inference, inference.csv containing standard errors, t statistics, p-values and confidence intervals. Choose it for calibration curves or simple explanatory fits whose error or coefficient limits you can state in advance.
Common mistakes and assumptions:
- There must be more training rows than coefficients, and the predictors must not be (nearly) linearly dependent; otherwise INSUFFICIENT_DATA, RANK_DEFICIENT_DATA or ILL_CONDITIONED_DATA.
- Only additive numeric terms: no categorical variables, interactions, polynomials or custom formulas.
- Optional inference assumes independent, constant-variance, normal errors; an exact fit has no residual variance (NO_RESIDUAL_VARIANCE). No causal claims; held-out errors describe only the rows you supplied.
- A correct fit that misses a declared requirement fails with FIT_REQUIREMENT_NOT_MET and is not passed to later workflow steps.
Native binding: stats::lm / base::saveRDS / stats::predict / stats::summary.lm / stats::confint. Output kind: ["table","text"].
Inputs: none.
| Option | Meaning | Type / constraints | Default |
|---|---|---|---|
predictors |
The 1 to 8 explanatory variables, in the order their values appear in every training and held-out row. Each gets one coefficient in the fitted model. | {"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":32,"required":true},"unit":{"type":"string","minLength":1,"maxLength":32,"required":true}},"required":true},"minItems":1,"maxItems":8} |
required |
response |
Observed dependent numeric quantity with a distinct lowercase name and plain unit label. It is the final cell of every training/held-out row. | {"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":32,"required":true},"unit":{"type":"string","minLength":1,"maxLength":32,"required":true}}} |
required |
training |
The 4 to 512 observations used to fit the model; each row lists the predictor values in declared order and then the observed response. The rows must contain more observations than coefficients and enough independent variation in the predictors; a numerical conditioning limit (1e6 after scaling) rejects nearly dependent predictors. | {"type":"array","items":{"type":"array","items":{"type":"number","minimum":-1000000000.0,"maximum":1000000000.0},"minItems":2,"maxItems":9},"minItems":4,"maxItems":512} |
required |
heldout |
Optional one to 512 separate observed rows in the same predictor/response order. These finite rows assess declared prediction errors, not future generalisation; no automatic split. | {"type":"array","items":{"type":"array","items":{"type":"number","minimum":-1000000000.0,"maximum":1000000000.0},"minItems":2,"maxItems":9},"minItems":1,"maxItems":512} |
omitted |
intercept |
Include a constant coefficient, default true. Disable only when a zero response at zero predictors is a justified model constraint; training rows must exceed coefficient count. | {"type":"boolean"} |
true |
inference |
Optional classical inference for the fitted coefficients. When present, regression-summary.json gains standard errors, t statistics, two-sided p-values and confidence intervals for every coefficient, the residual standard error, R-squared, adjusted R-squared and the overall F test, and inference.csv is published last. These quantities are valid only if the additive linear mean is right and the errors are independent, constant-variance and normally distributed; they describe uncertainty in the coefficients, not the spread of future observations. | {"type":"object","properties":{"level":{"type":"number","minimum":0.5,"maximum":0.999,"default":0.95}}} |
omitted |
requirements |
Optional one to 32 named finite fit requirements. Native computation verification comes first; unmet requirements block success and downstream reuse. | {"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64,"required":true},"scope":{"type":"enum","values":["training","heldout"],"required":true},"metric":{"type":"enum","values":["rmse","maxAbsoluteError","prediction","coefficientInterval"],"required":true},"term":{"type":"string","minLength":1,"maxLength":32},"sampleIndex":{"type":"integer","minimum":0,"maximum":511},"minimum":{"type":"number","minimum":-1e+18,"maximum":1e+18},"maximum":{"type":"number","minimum":-1e+18,"maximum":1e+18}}},"minItems":1,"maxItems":32} |
omitted |