You are on page 1of 3

Using Excel to do least squares

As an example, data points given in table (1) will be used to perform lease squares
method. From these data we will find the slope and the intercept of the graph of Y vs X.
1 . Enter data in two columns, X (l/T values) first, then Y (ln(k)) values, for example.
2. Select a 2 x 2 array (2 rows and columns) anywhere on the spreadsheet.
3. In the formula pane type =Linest(B2:B10,A2:A10, true,true). Where the range
B2:B10 determines theY values and the range A2:A10 determines the X values.
4. Do CTRL SHIFT ENTER to enter the formula in the array.
5. The least squares numbers that fit to a straight line will appear as:
Slope
Std. Dev. Slope

Intercept
Std. Dev. Intercept

Table (1).
X

1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
9.0

1.1
2.0
2.9
3.9
5.0
6.1
7.0
8.1
8.9

Slope= 0.9983 error in slope= 0.012


Intercept= 0.0083 error in intercept = 0.067

Once you get the slope and intercept, select the two data columns (A and B
in the example), click on INSERTon Charts, choose scatter diagram.
Then on graph that showed up, click on a point with left button and then
click right button on mouseformat trendline appearschoose linear,
then display equation and R-squared. Closer R squared is to 1, better the
linear fit.

Slope= 0.9983 error in slope= 0.012


Intercept= 0.0083 error in intercept = 0.067

Slope= 0.9983 error in slope= 0.012


Intercept= 0.0083 error in intercept = 0.067

You might also like