Line of best fit

Discuss the spreadsheet application
Post Reply
jdn103
Posts: 1
Joined: Thu Sep 24, 2009 2:22 am

Line of best fit

Post by jdn103 »

hi!
does anyone know how to calculate the line of best fit? I really need help with this.
thanks!
OpenOffice 3.0.1 on Ubuntu 9.04
FJCC
Moderator
Posts: 9248
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: line of best fit

Post by FJCC »

There are three ways, at least, to get the best linear fit to data. You can use the functions SLOPE and INTERCEPT in separate cells. These functions have the form

Code: Select all

=SLOPE(YRange;XRange)
=INTERCEPT(YRange;XRange)
You can also use the RSQ() function to get the R^2 of the fit.

You can use the array function LINEST() to get the linear fit. It returns various statistics in addition to the slope and intercept. I suggest you check out the Help section, as that function is more complicated.

Finally, if the data are used in a scatter chart, you can double click on the chart to put it in edit mode and then go to Insert -> Trend Lines to add the line, equation and R Squared to the chart.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
Cambirder
Volunteer
Posts: 647
Joined: Thu Nov 22, 2007 1:01 am

Re: line of best fit

Post by Cambirder »

Alternatively you can plot the data as an X Y scatter chart, and add a a trend line.

In edit mode right click on any of the plot points select add trend line, and from the pop-up window chose Linear regression and tick the show equation box.
OOo 3.3 on Windows 7 & 3.2.1 on Mint 10
User avatar
merikilpikonna
Posts: 3
Joined: Sun Dec 13, 2009 12:37 am

Re: Line of best fit

Post by merikilpikonna »

is it also possible for non linear curves?

old posts suggest that there has been a statistics tab in earlier oo versions, but i can not find an equivalent.
OpenOffice 3.1 on Ubuntu 9.10
FJCC
Moderator
Posts: 9248
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Line of best fit

Post by FJCC »

If you search the Help Index of OpenOffice Charts for Trend Lines in Charts, you will find formulas for finding the parameters of various kinds of non-linear fits.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Post Reply