In some instances, we might want to prove that there is a functional relationship between two variables and, hence, just use one of them in our model – since the other can be easily approximated by an expression. In this case, it is useful to rely on the least squares method. Given a set of points (xi,yi) and a function such as y'i = f(xi), this method minimizes the square of the differences between y'i and yi. The general expression for the minimization that we are calculating is as follows:
![](https://static.packt-cdn.com/products/9781789345377/graphics/assets/e1580832-57ab-4e80-9900-c20bd1c646d9.png)
We will use two columns from our data table, namely weight and mpg:
- Create a new table in a new sheet.
- Copy the values of the weight and mpg columns.
- Order the rows by the value of weight; the resulting table is as follows:
![](https://static.packt-cdn.com/products/9781789345377/graphics/assets/0e981124-8900-4e46-9cdb-c7cae4f4f009.png)
- Insert a line chart to see what the functional relationship looks like, as follows:
![](https://static.packt-cdn.com/products/9781789345377/graphics/assets/406a31b6-bcca-4f3e-babb-ea52ab3d1997.png)
Let's say that we assume...