Fitting a straight line to bivariate data is known as linear regression and is particularly useful in finding a relationship between two variables.

## Fitting a linear line by eye

- Plot the points
- Fit a line of best fit by having the same number of points on each side of the line
- Pick two points on your line and find the gradient (slope).

- Pick one of the points and find the equation of the line:

### Application

In this example, there are 5 data points above and below the line. The two points that could be used to find the gradient is (30, 25) and (60, 65). The gradient, *m,* is therefore 1.33. Using the point (30, 25) again, the *c* value is -15. The estimated line is therefore

However, this method is not unique and is not easily reproduced. Because of this, it is preferred that a least square regression line is used.

## Least squares regression line

The least squares regression line is used to fit straight line to data. An alternative method is the three median regression line. This method is based on minimising the sum of the squared values of the residuals.

The equation of the least squares regression line is:

where is the slope, given by

and is the intercept, given by

is the correlation coefficient

and are the standard deviations of *x* and* y*

and are the mean values of *x* and *y*

If this method is used using the data on the previous page for Test 1 and Test 2, the equation would be:

This is a more accurate formula.

**See also:**

## Feedback

Want to suggest an edit? Have some questions? General comments? Let us know how we can make this resource more useful to you.