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
To obtain the equation for the line of best fit in Excel, users can utilize the "least squares" method for polynomial fitting, with options available up to the sixth order, as well as exponential curves. After plotting the data points on an XY-scatter chart, adding a trendline through the chart properties allows for visual representation. To display the equation of the trendline, users must check the appropriate box in the Options tab. For a more precise calculation, the LINEST function can be employed, requiring the input of x and y data ranges along with parameters for intercept and statistics. This function must be entered as an array formula by selecting a 3x2 block of cells and using Ctrl+Shift+Enter. Additionally, users are encouraged to explore Excel's help system for further guidance on array formulas and the LINEST command.
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:
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...

Similar threads

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