### Linear Curve Fitting

• Find equation of the best fit line for a scatter plot using concept of least square regression.

### Solved Example:

#### 10-1-01

Use the least square method to develop a linear trend equation for the data from the following data. State the equation and forecast a trend value for population in the year 2022. Solution: $a = \dfrac{\Sigma Y}{n} = \dfrac{77}{5} = 15.4, \quad b = \dfrac{\Sigma XY}{\Sigma X^2}= \dfrac{18}{10} =1.8$ The forecasting equation is of the form Y = a + bX
Y = 15.4 + 1.8 X (for year 2019, X = 0).
For year 2022, code=3
$Y_{2022}=15.4+1.8 \times 3 = 20.8$
Hence the population will be 20.8 thousands or 20800.

### Solved Example:

#### 10-1-02

Determine a forecast for engine oil shipments when the number of cars sold are 30000. Solution: \begin{align*} \bar{X} &= \dfrac{\Sigma X}{n} = \dfrac{144}{6} = 24\\ \bar{Y} &= \dfrac{\Sigma Y}{n} = \dfrac{65}{6} = 10.833 \end{align*} \begin{align*} b &= \dfrac{\Sigma XY - n \bar{X} \bar{Y}}{\Sigma X^2 - n {\bar{X}}^2}\\ &= \dfrac{1831 - 6 (24) (10.833)}{4156 - 6 {(24)}^2}\\ &= \dfrac{271}{700} = 0.39\\ a &= \bar{Y} - b\bar{X}= 10.833 - 0.3871 \times (24)= 1.54 \end{align*}

The regression equation is Y= 1.54 + 0.39 X (X = Cars Sold in '000, Y = Engine oil shipments)

Then, letting X = 30,

$Y = 1.54 + 0.39(30) = 13.24$, which is $\approx$ 13 shipments.

### Solved Example:

#### 10-1-03

You are a car dealer specializing in the sale of 2016 Toyota Camry. Following is the data of seven different cars you have sold recently. Assume all cars in your shop are in same condition and only odometer (km) reading decides the selling price. A person who can afford to spend only \$9000, what will be the odometer (km) reading he can expect for his future car? Solution: $\bar{X} = \dfrac{\Sigma X}{n} = \dfrac{259}{7} = 37$ $\bar{Y} = \dfrac{\Sigma Y}{n} = \dfrac{96.7}{7} = 13.8$ \begin{align*} b&= \dfrac{\Sigma XY - n \bar{X}\bar{Y}}{\Sigma X^2 - n \bar{X}^2}\\ &= \dfrac{3533.2 - 7 \times 37 \times 13.8}{9791 - 7 \times 37^2}\\ &= \dfrac{-41}{208}\\ &= -0.197 \end{align*} $a= \bar{Y} - b \bar{X} = 13.8 - (-0.197) \times 37 = 21.089$ \begin{align*} Y &= a + bX \\ 9 &= 21.089 + (-0.197) X\\ X &= 61.365 \end{align*}

So, he can expect a car with 61000 km.