feat(HF-221): add LINEST regression function - #1769
Tobiadefami wants to merge 5 commits into
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 (b8a20aa) vs base (c920375) |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
hyperformula-docs | b8a20aa | Commit Preview URL Branch Preview URL |
Sep 14 2026, 07:01 PM |
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 15982 +243
Branches 3390 3525 +135
===========================================
+ Hits 15318 15564 +246
+ Misses 421 410 -11
- Partials 0 8 +8
🚀 New features to boost your workflow:
|


Context
Adds
LINEST(known_y, [known_x], [const], [stats])for simple and multiple linear regression, including an optional intercept and the complete five-row statistics result. Supports row and column layouts, omitted predictors, redundant predictors, and array expressions.Uses pivoted Householder QR and triangular solves for coefficient uncertainties. Standard errors accumulate scaled magnitudes with
Math.hypot, avoiding overflow or underflow from intermediate squares when the final uncertainty is representable. Includes localized function names, catalogue metadata, JSDoc, documentation, and a changelog entry.Compatibility limits
statsmust be constant; references or calculated expressions return#VALUE!. Input expressions that change the predicted predictor count also return#VALUE!. Referencedconstvalues can recalculate normally.How did you test your changes?
Compared complete result matrices and error types against Excel Online observations. Added regression coverage for finite coefficient/intercept uncertainties at extreme scales and comparisons that cannot accept zero for tiny nonzero results.
Validation: 124 focused LINEST tests passed; the full Jest suite passed (503 suites, 6,357 tests); Chrome 153 and Firefox 155 each passed 6,357 tests. Three existing tests are skipped in each full suite. Compile, function documentation generation, full lint (zero errors), and the LINEST benchmark passed. The repository-wide performance checks also passed.
Related task: HF-221.