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:
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:
- Insert a line chart to see what the functional relationship looks like, as follows:
Let's say that we assume...