In this exercise, we will assume a basic familiarity with Microsoft® Excel™ spreadsheet software. Some background information about Microsoft Excel is provided at the link to the right. We will briefly present the use of Microsoft Excel to perform linear regression, or fitting a straight line to a set of data. The form of the equation of a straight line is:
\[y = mx + b\]
In equation (1), x is the abscissa and y is the ordinate, while m is the slope of the line, and b is the y-intercept.
The use of Microsoft Excel to fit a straight line to a set of data will be presented in the context of an example. We will assume that we have measured a set of five data points as follows:
In the above set of numbers, the data are presented in pairs of (x,y) points. Steps for using this data to create a straight-line curve fit using Microsoft Excel are presented below.
First, we need to enter the data into Microsoft Excel. We will input the x data into the first column and the y data in the second column. Our spreadsheet looks as shown below.
Select the data in the spreadsheet by clicking and dragging from cell A1 to cell B5. Select the Insert tab and click on Scatter under the chart options and select the option that displays data points, as shown below.
A chart should be added to your spreadsheet, similar to the one shown below.
Under the Chart Tools, click on the Layout tab. Click on the Trendline button and select More Trendline Options, as shown below.
You should get a dialog box. Choose a Linear trendline and select Display Equation on Chart and Display R-squared value on chart, as shown below. Click on Close.
The equation of the best-fit straight line and the correlation coefficient are added to the chart. Your chart should look approximately as shown below.