Spreadsheets: linear regression in four easy steps on Excel or LibreOffice Calc
The tutor shows how to get a best-fit line using Excel or LibreOffice Calc.
Let’s imagine you want a best fit line of form y=mx + b for the following data:
| x | y |
| 0 | 3 |
| 2 | 5 |
| 6 | 10 |
| 8 | 12 |
With Excel or LibreOfficeCalc, you do exactly the same steps:
- Enter the data in two columns. Let’s imagine the x data is in a1:a4, the y, b1:b4.
- In a different cell, key in =slope(b1:b4,a1:a4). Note that the y range is entered first. The answer that appears is the slope of the line, or m. Hopefully, in this case, you get 1.15.
- In another cell, key in =intercept(b1:b4,a1:a4). The answer returned is the y intercept, or b; in this case, it’s hopefully 2.9.
- For this data, the best-fit line is y=1.15x + 2.9
HTH:)
Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.
Leave a Reply
You must be logged in to post a comment.