How is a polynomial trendline calculated in a graph?

Discuss the spreadsheet application
Locked
sutterp
Posts: 6
Joined: Mon May 12, 2014 2:22 pm

How is a polynomial trendline calculated in a graph?

Post by sutterp »

Could someone please clarify how Openoffice or Libreoffice calculates a polynomial trendline?

According to libreoffice documentation, https://help.libreoffice.org/Chart/Trend_Lines the last section states that linest(y_range,xrange,type,stats) returns the equation.

However, the numbers stated in the graph's trend line equation (coefficients and r^2) are vastly different to what linest over the same data range reports.

What am I missing

thanks

Peter
Attachments
linest-graph.ods
(57.05 KiB) Downloaded 199 times
Last edited by RoryOF on Sat Aug 26, 2017 8:55 am, edited 1 time in total.
Reason: Corrected typo in subject [RoryOF, Moderator]
LibreOffice 3.5.7.2
Ubuntu 12.04 LTS
User avatar
Zizi64
Volunteer
Posts: 11511
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How is a polynomial trendline calculated in a graph?

Post by Zizi64 »

There are an extension for the polinomial regression (because the AOO Calc does not have such feature, the AOO can not calculate the polinomial regression by default.)
https://extensions.libreoffice.org/exte ... rend-lines

I just installed it (for my Libreoffice 5.3.5) , and I got a third set of the results. I suppose it is related to the numeric accuracy of the office suite... (or not...)


((As I can remember it, there was a bug in the regression of the Graph module, but (i think) it is fixed by now.))
Last edited by RoryOF on Sat Aug 26, 2017 8:56 am, edited 1 time in total.
Reason: Corrected typo in subject [RoryOF, Moderator]
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
sutterp
Posts: 6
Joined: Mon May 12, 2014 2:22 pm

Re: How is a polynomial trendline calculated in a graph?

Post by sutterp »

Which of the three results is the most accurate now?
This almost destroys my beliefs in mathematics!!! I learned that if one as a question mathematically, one will always get the same answer. :-(
Which one is it? LINEST? or which one of the graphs? Only one can be mathematically sound.
LibreOffice 3.5.7.2
Ubuntu 12.04 LTS
User avatar
MrProgrammer
Moderator
Posts: 5473
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: How is a polynomial trendline calculated in a graph?

Post by MrProgrammer »

sutterp wrote:I learned that if one as a question mathematically, one will always get the same answer.
You're not using mathematics. You're using floating point arithmetic, which is a close approximation but not exact. Differences can occur depending on the data and the algorithm being used to calculate the result. Regression analysis is a computation which tends to highlight the shortcomings of floating point arithmetic and algorithms.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.8, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
sutterp
Posts: 6
Joined: Mon May 12, 2014 2:22 pm

Re: How is a polynomial trendline calculated in a graph?

Post by sutterp »

Thanks for that.
I realize that floating point arithmetic has its shortcomings, especially when dealing with mixed very small and very large numbers.
However, the discrepancy between what the trendline equation states and what linest reports are too big for my liking. To me it appears that linest might be the more accurate, but not knowing how the trendline equation is calculated makes it difficult to decide.
LibreOffice 3.5.7.2
Ubuntu 12.04 LTS
User avatar
Lupp
Volunteer
Posts: 3761
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: How is a polynomial trendline calculated in a graph?

Post by Lupp »

It's not just floating point. Any arithmetic with limited precision (and that's next to any arithmetic above school grade 5 I suppose) has its shortcomings. That's a blessing in disguise. Otherwise our excessive belief in arithmetics would be even more dangerous.

On the other hand there are some aspects which always should be considered if 'Charts' seem to be the means of choice. This the more if 'Trend Lines' shall be used. Polynomial approximation has its basic limits, too.

See attached example (For LibO only; AOO charts are outdated with respect to scaling and Trend Lines.):
Attachments
aoo90112ChartBasedOnDatesWithTrendLineOfSixthOrder_1.ods
(55.2 KiB) Downloaded 217 times
On Windows 10: LibreOffice 25.8.4 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
Locked