## Line of best fit

### Line of best fit

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
jdn103

Posts: 1
Joined: Thu Sep 24, 2009 2:22 am

### Re: line of best fit

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   Expand viewCollapse view
`=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.
AOO 3.4 or 4.1 on MS Windows XP ( before 2013-08-03) or Windows 7
FJCC
Moderator

Posts: 6463
Joined: Sat Nov 08, 2008 8:08 pm

### Re: line of best fit

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

Cambirder
Volunteer

Posts: 647
Joined: Thu Nov 22, 2007 1:01 am

### Re: Line of best fit

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

merikilpikonna

Posts: 3
Joined: Sun Dec 13, 2009 12:37 am

### Re: Line of best fit

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.
AOO 3.4 or 4.1 on MS Windows XP ( before 2013-08-03) or Windows 7