Mathematics for the least-squares slope#
This page follows on from the page on mean squared deviations. Like that page, is assumes a lot more maths than the standard flow of the course. In particular, it assumes that you know the basics of finding the derivative of a function.
Please make sure you have read and understand the mean squared deviation page, because this page builds on that argument.
You should also check the page on means and slopes for the problem we are trying to solve.
In our problem, we have
We decide we will use a straight line going through the origin to predict
our
We want to choose
The
This is the general formula for the specific plot we saw at the end of mean
and slope page, where the value for
We want to find the value of
The plot turned out to be U-shaped; we want to find the horizontal axis
location (
We follow the same scheme as for the mean squared deviations page; we transform the formula in (3) above into a formula for the gradient of the line that (3) represents, by taking the derivative. When the derivative of equation (3) is equal to zero, it means the gradient of (3) is 0, and this is true when we are at a peak or a trough of (3). We want the trough.
First we expand (3), and use the laws of sums to simplify the result:
Now differentiate with respect to
Find the zero(s) for equation (4):
Equation (4) only has one zero.
We take the second derivative of (4) to see if the solution to
This is the value