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

--- Comment #5 from Matthias Becht <matthi...@protonmail.com> ---
Hmm, I just remembered what the biggest problem was, which I forgot to mention
before. There needs to be at least one more sample than there are x variables
in order for the multiple linear regression to work out (or at least that's how
I understand it). Commons Math throws an IllegalArgumentException is there are
too few samples, which is why I had added the check for `x[0].length >=
x.length`. Excel, however, still calculates something, I'm just not sure
exactly what. It almost seems as if it just somehow picks which variables to
use.

Regarding all x's being the same: it seems that Excel does do a bit more than
just return the average. If the constant is set to FALSE and values are given
for new_x's, it pretends that only one point was given: (x value - constant,
average y value). Using that, it can then do a simple linear regression between
that point and (0, 0). I don't know what it does though when there are multiple
x variables on top of that because it still calculates *something*.

I also realized later that what I said about Excel silently adding the point
(0,0) when the constant is set to FALSE and there is only one y value is not
entirely true either. Excel actually doesn't just return the y value when there
are multiple x variables, it still calculates something, but again, I'm not
entirely sure *what*.

I'm not entirely sure what the best solution is in this case because every
option I tried caused other problems. Of course it is quite possible that there
is a very obvious solution which I simply missed.

Sometimes I wish that instead of making Excel more "user-friendly", the
developers had just stuck to the basic mathematical rules instead, especially
since hitting any of these corner cases while trying to predict something
probably means you're doing something wrong anyways.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to