# Least squares estimation

## Least squares estimation :

Least squares estimation is a statistical technique that is used to find the line of best fit for a given set of data. This line of best fit is determined by minimizing the sum of the squares of the vertical distances between the data points and the line.
To illustrate this concept, let’s consider two examples.
Example 1:
Suppose we have a set of data that represents the heights (in inches) and weights (in pounds) of a group of individuals. We can plot these data points on a scatter plot and try to find the line of best fit using least squares estimation.
First, we need to define the line of best fit mathematically. In this case, we can use the following linear equation: y = mx + b, where y is the weight, x is the height, m is the slope of the line, and b is the y-intercept (i.e., the point where the line crosses the y-axis).
Next, we need to find the values of m and b that minimize the sum of the squares of the vertical distances between the data points and the line. This can be done using a mathematical optimization technique called gradient descent. In short, this technique involves iteratively updating the values of m and b in a way that gradually reduces the sum of the squares of the vertical distances.
Once we have found the optimal values of m and b, we can use these values to plot the line of best fit on the scatter plot. This line represents the relationship between height and weight that best fits the data.
Example 2:
Now let’s consider a slightly more complex example involving multiple variables. Suppose we have a set of data that represents the scores of students on two different exams. We can plot these data points on a scatter plot and try to find the plane of best fit using least squares estimation.
In this case, we can use the following equation to define the plane of best fit: y = ax + bz + c, where y is the score on the first exam, x is the score on the second exam, a is the slope in the x-direction, b is the slope in the z-direction, and c is the y-intercept.
Once again, we need to find the values of a, b, and c that minimize the sum of the squares of the vertical distances between the data points and the plane. This can be done using a similar optimization technique as before.
Once we have found the optimal values of a, b, and c, we can use these values to plot the plane of best fit on the scatter plot. This plane represents the relationship between the scores on the two exams that best fits the data.
In conclusion, least squares estimation is a useful statistical technique that allows us to find the line or plane of best fit for a given set of data. This line or plane can provide valuable insights into the underlying relationship between the variables in the data.