GNOME Bugzilla – Bug 551457
LINEST fails with linearly dependent x values
Last modified: 2013-05-14 12:51:50 UTC
Of course there are many data sets on which LINEST will justifiably fail. Nevertheless, if the newer versions of XL can handle the data shown in the attached screen shot, then so should Gnumeric. See http://support.microsoft.com/kb/828533 on further discussions re XL.
Created attachment 118342 [details] Screen shot referred to in previous comment
*** Bug 615772 has been marked as a duplicate of this bug. ***
What result would you like for this example? The x columns are linearly dependent, so there is a good deal of choice. What does a recent Excel produce?
Morten: If you have a look at the link in the original description, you find the example to be the second example given there. The page also gives what is apparently the solution found by newer version of Excel. Note that theh screen shot in comment #1 does not use linearly dependent columns (column D is not used for this specific example and columns b and c are not linearly dependent).
Created attachment 158890 [details] Test file I now see that the third column is not in play. Confirming current behaviour and attaching test case.
The third argument to linest is true. That is the same as adding a constant-1 column, so the columns really are linearly dependent.
Correct. So excel removes variables in this case.
We need to compute the pseudo-inverse and use that in place of (A^t*A)^-1*A^t
Created attachment 243555 [details] Preliminary patch With the attached patch, we generate some values: 0.29824561403509 0.35964912280702 -0.06140350877193 2.50514691948029E+30 2.50514691948029E+30 2.50514691948029E+30 0.98684210526316 0.25649458802129 0 74.9999999999998 2 0 9.86842105263158 0.13157894736842 0 These values differ from XL's. The residual matches, though. (And the second line needs work.)
Different solution committed. Pending verification that we do the right thing.
This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.