After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 551457 - LINEST fails with linearly dependent x values
LINEST fails with linearly dependent x values
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Analytics
git master
Other All
: Normal normal
: ---
Assigned To: Morten Welinder
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2008-09-09 02:56 UTC by Andreas J. Guelzow
Modified: 2013-05-14 12:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screen shot referred to in previous comment (53.82 KB, image/png)
2008-09-09 02:57 UTC, Andreas J. Guelzow
Details
Test file (1.90 KB, application/x-gnumeric)
2010-04-16 12:39 UTC, Morten Welinder
Details
Preliminary patch (3.30 KB, application/octet-stream)
2013-05-08 01:09 UTC, Morten Welinder
Details

Description Andreas J. Guelzow 2008-09-09 02:56:19 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.
Comment 1 Andreas J. Guelzow 2008-09-09 02:57:01 UTC
Created attachment 118342 [details]
Screen shot referred to in previous comment
Comment 2 Andreas J. Guelzow 2010-04-14 22:13:38 UTC
*** Bug 615772 has been marked as a duplicate of this bug. ***
Comment 3 Morten Welinder 2010-04-16 00:36:20 UTC
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?
Comment 4 Andreas J. Guelzow 2010-04-16 04:10:48 UTC
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).
Comment 5 Morten Welinder 2010-04-16 12:39:48 UTC
Created attachment 158890 [details]
Test file

I now see that the third column is not in play.  Confirming current
behaviour and attaching test case.
Comment 6 Morten Welinder 2010-04-16 12:46:41 UTC
The third argument to linest is true.  That is the same as adding a
constant-1 column, so the columns really are linearly dependent.
Comment 7 Andreas J. Guelzow 2010-04-16 13:48:37 UTC
Correct. So excel removes variables in this case.
Comment 8 Morten Welinder 2013-04-29 21:51:13 UTC
We need to compute the pseudo-inverse and use that in place of
(A^t*A)^-1*A^t
Comment 9 Morten Welinder 2013-05-08 01:09:27 UTC
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.)
Comment 10 Morten Welinder 2013-05-13 02:18:47 UTC
Different solution committed.

Pending verification that we do the right thing.
Comment 11 Morten Welinder 2013-05-14 12:51:50 UTC
This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.