One can easily pot data as a scattered manner on a graph. It basically depends on the data given to us as to how can it be plotted. For prediction of values in a scattered kind of data we make use of a straight line representing an equation which is not actually displayed on the graph. This straight line is known as line of best fit. In other terms it is also referred to as the trend line.

## Line of Best Fit Definition

We can define the line of best fit as the line that represents the data of a scatter plot diagram in the best manner. The line of best fit may pass through some points of the scatter plot, may even pass through all the points or at times may not even pass through any point of the scatter plot.

## How to Find and Draw The Line of Best Fit

To find the line of best fit we can use two methods: one is the spaghetti method and the second one is using least square method. The first one is a random method according to which we get different lines of best fit as the judgment varies from person to person. The least square method gives a general and more accurate line of best fit for a given set of values. With this method the line so obtained is a common line for every person determining it for the same set of values given. Once the line is obtained by using the spaghetti or judgment method we can easily find the equation of the line using point slope formula or two point formula of finding the equation of the line. In the other method we will obtain the equation first using which we can easily draw the line of best fit of the graph via finding points lying on the equation so obtained and joining them.

## Line of Best Fit Equation

Once the line of best fit is drawn one can easily find the equation of the line using any method of finding equation of a line may it be point slope or two point method.

## Line of Best Fit Formula

Usually we can make a line of best fit by the judgment of eyes which may vary from person to person. But a more accurate way of finding the line of best fit for a particular data is to make use of the least square method to determine the line of best fit.

In this method we first calculate the mean of all the x- values and the mean of all the y- values separately. Let the means be denoted by X and Y. Then we use the formula below to find the slope of the line of best fit.
$m$ = $\frac{[\sum_{(i = 1)}^{n}\ {(x_{i}\ –\ X)\ (y_{i}\ –\ Y)}]}{[\sum_{(i = 1)}^{n}\ {(x_{i}\ –\ X)^{2}}]}$
Next we determine the y- intercept of the line of best fit using the formula given below.

$b\ =\ Y\ –\ m\ X$

Now we make use of the slope and the y- intercept to find the equation of the required line of best fit using the formula $y\ =\ mx\ +\ b$.

This is a more accurate method and does not change the equation of the line of best fit which does when we do it be judgment. With this method we can have a common line of best fit for a given set of data values.

## Line of Best Fit Examples

Let us see an example on the basis of the same concept for understanding it more.

Example:

For the following data, determine the line of best fit and then plot on graph.

 X 11 2 8 6 5 4 9 12 1 6 Y 3 10 3 6 8 12 4 1 14 9

Solution:

We will make use of the method of least square for determining the equation of line of best fit in this case.

Mean of all x values, $X$ = $\frac{(11 + 2 + 8 + 6 + 5 + 4 + 9 + 12 + 1 + 6)}{10}$ = $\frac{64}{10}$ = $6.4$

Mean of all y values, $Y$ = $\frac{(3 + 10 + 3 + 6 + 8 + 12 + 4 + 1 + 14 + 9)}{10}$ = $\frac{70}{10}$ = $7$

Now we make the table for the values as below

 $x_{i}$ $y_{i}$ $x_{i}\ -\ X$ $y_{i}\ –\ Y$ $(x_{i}\ –\ X)\ (y_{i}\ –\ Y)$ $(x_{i}\ –\ X)^{2}$ 11 3 4.6 -4 -18.4 21.16 2 10 -4.4 3 -13.2 19.36 8 3 1.6 -4 -6.4 2.56 6 6 -0.4 -1 0.4 0.16 5 8 -1.4 1 -1.4 1.96 4 12 -2.4 5 -12 5.76 9 4 2.6 -3 -7.8 6.76 12 1 5.6 -6 -33.6 31.36 1 14 -5.4 7 -37.8 29.16 6 9 -0.4 2 -0.8 0.16 Sum = -131 Sum = 118.4

Slope, $m$ = $\frac{-131}{118.4}$ = $-1.1$ (approx)

$b\ =\ 7\ –\ (-1.1\ \times\ 6.4)\ =\ 14.0$ (approx.)

The equation of line of best fit, $y\ =\ -1.1\ \times\ +\ 14$

Graph: