feat(HF-221): add LINEST regression function - #1769
Conversation
|
@Tobiadefami thanks for the pull request. No CLA step needed here — our records show you signed the Contributor License Agreement on 2026-07-31. That signature came from our previous signing form and has been carried over, so there is nothing for you to re-sign. |
|
Task linked: HF-221 Function LINEST |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 64b6393. Configure here.
| const interceptError = fitIntercept ? finiteValue(fit.interceptError) : new CellError(ErrorType.NA) | ||
| result.push([...fit.standardErrors].reverse().map(finiteValue).concat(interceptError)) | ||
| result.push([finiteValue(rSquared), finiteValue(Math.sqrt(variance))]) | ||
| result.push([f, fit.degreesOfFreedom]) |
There was a problem hiding this comment.
Degenerate LINEST stats emit zeros
Medium Severity
When residual degrees of freedom is 0 (exact interpolation, including the common two-point LINEST with stats enabled), uncomputable uncertainties are emitted as 0 and F becomes #NUM!. Excel and Sheets return #N/A for the coefficient standard errors, residual standard error, and F in that case, so a zero standard error can look like a precise fit instead of an undefined statistic.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 64b6393. Configure here.
Performance comparison of head (65cb773) vs base (c920375) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1769 +/- ##
===========================================
+ Coverage 97.32% 97.38% +0.05%
===========================================
Files 195 197 +2
Lines 15739 15957 +218
Branches 3390 3518 +128
===========================================
+ Hits 15318 15539 +221
+ Misses 421 410 -11
- Partials 0 8 +8
🚀 New features to boost your workflow:
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
hyperformula-docs | 65cb773 | Commit Preview URL Branch Preview URL |
Sep 10 2026, 07:58 PM |


Context
How did you test your changes?
Types of changes
Related issues:
Checklist:
Note
Medium Risk
New array-returning statistical function with strict static
statssizing and numerically sensitive regression output; limited blast radius but worth careful review against Excel edge cases.Overview
Adds
LINESTfor simple and multiple linear regression, with optional intercept (const) and an optional five-row statistics block (stats).Implementation is a new
RegressionPluginplus afitLinearRegressionnumerical core (pivoted Householder QR, rank handling aimed at Excel-like behavior). Result width follows predictor layout (paired, column, or rowknown_x);linestArraySizefixes array height/width before evaluation. Unlike Excel,statsmust be a compile-time constant (e.g.TRUE()/FALSE()); cell references or computed booleans yield#VALUE!, with matching runtime checks so nested formulas cannot bypass sizing.Docs cover LINEST limitations and Excel/Google numerical differences; changelog, function metadata, error messages, and localized function names are updated.
Reviewed by Cursor Bugbot for commit 65cb773. Bugbot is set up for automated code reviews on this repo. Configure here.