How can I use Excel to find the line of best fit for a set of data points?

  • Thread starter Thread starter JamesJames
  • Start date Start date
  • Tags Tags
    Excel Fit Line
Click For Summary

Discussion Overview

The discussion revolves around how to use Excel to find the line of best fit for a set of data points. Participants explore various methods and tools available within Excel for fitting data, including polynomial fits and trendlines.

Discussion Character

  • Technical explanation
  • Exploratory
  • Homework-related

Main Points Raised

  • One participant inquires about the process of obtaining the line of best fit for their plotted data points in Excel.
  • Another participant suggests using a "least squares" fit and mentions that Excel can fit data points to various polynomial orders, up to 6th order, and provides information about the correlation coefficient.
  • A different participant notes that adding a trend line is straightforward but obtaining the equation may require additional steps, including the use of an add-in.
  • Another reply specifies the steps to add a trendline in an XY-scatter chart and how to display the equation of the line.
  • One participant provides the Excel command LINEST and explains how to use it with specific parameters for calculating the line of best fit, including details about entering the formula as an array.

Areas of Agreement / Disagreement

Participants present multiple methods for finding the line of best fit, indicating that there are various approaches available in Excel. No consensus is reached on a single best method, as different participants highlight different tools and techniques.

Contextual Notes

Some methods mentioned may depend on the version of Excel being used or require specific add-ins that may not be installed by default. The effectiveness of each method may vary based on the data set and user familiarity with Excel features.

JamesJames
Messages
204
Reaction score
0
:confused: I have plotted a few points (8 infact ) in Excel and would like to acquire the equation for the line of best fit. How do I do this using the computer or do I have to do it by hand?
 
Computer science news on Phys.org
You can either do a "least squares" fit to what ever order of polynomial you want to use. In Excel, plot the data points, then you can fit the data points to any order of polynomial up to 6th order, exponential curve and a few more I ccannot remember. The correleation coefficient is diplayed on the polt, so you can determine the best equation from that.
 
Adding a trend line is easy through the chart properties, but fitting an equation is a little tougher (unless you do it manually by looking at the fitted trend-line). IIRC, it requries an add-in that is not installed automatically. In the tools menu, click "add-ins" and I think the "Solver add-in" is the one you need.
 
In Excel, when viewing an XY-scatter chart look for the "Chart" menu and select "Add Trendline". To get the equation of the line, you have check the box in the Options tab of "Add Trendline".
 
The excel command you are looking for is

LINEST(yrange,xrange, b, stats)

for the x and y ranges enter the row column information for your data for example if your data is in the first 8 cells of the first 2 columns you would enter a1:a8 for the xrange and b1:b8 for the y range. The b and stats parameters are logical (b=true if you want Excel to compute the y intercept, b=false of you want it to be 0) The last gives more stats if you set it to true.

You need to select a 3x2 block of cells type = in the command line, enter the formula then type ctrl+Shift+enter to enter the Array formula.

You would do well to get into the Excel help system and research array formulas and the Linest command.

https://www.extendoffice.com/documents/excel/2642-excel-best-fit-line-curve-function.html
 
Last edited by a moderator:

Similar threads

  • · Replies 16 ·
Replies
16
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
6
Views
2K
  • · Replies 11 ·
Replies
11
Views
1K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 16 ·
Replies
16
Views
3K