https://bz.apache.org/bugzilla/show_bug.cgi?id=62836

--- Comment #2 from Yegor Kozlov <[email protected]> ---
Pretty impressive. This definitely should go in trunk. 

The not implemented cases aren't a problem of Commons Math.

>From a mathematical standpoint one needs minimum two data points to perform
linear regression. Excel handles the one-point case in which it returns the
data value, but it is more an internal convention. OpenOffice and Google
Spreadsheets return an error in such a case. POI can mimic Excel and return the
data value too and we can add a simple check.

The case when all y- and x- values are the same is not obvious. Commons Math
throws SingularMatrixException if the sample size is less than 5. Given
G110:G114 and H110:H114 containing the same value (e.g. 5):
TREND(G110:G112,H110:H112) // throws SingularMatrixException
TREND(G110:G113,H110:H113) // throws SingularMatrixException
TREND(G110:G114,H110:H114) // evaluates to 5

So, POI only needs to handle singular matrices smaller than 5. Again, it can be
done with a simple check without patching Commons Math.

>> Some of the code (especially for handling all the different shapes excel 
>> allows) is pretty rough, 
>> but I hope it's acceptable as a first implementation.

This is certainly okay for a first pass. 
I wonder if GROWTH, which has a similar semantics, can reuse the code from
TREND.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to