Derivation of the least-squares estimates
最小二乘估计的推导
Where do the least-squares estimates come from?
Treat the sum of squared residuals as a quadratic in the slope; setting the derivative to zero minimises it.
Sign in to read the whole lesson, with 2 exercises
Sign in / Sign upMastery goals
- Can derive the least-squares slope and intercept by minimizing the sum of squared residuals
8.2.2 Least-Squares Estimates of the Parameters of the Simple Linear Regression Model
In the simple linear regression model, the expression describes the linear correlation between the variable and the variable , where the parameters and are unknown and have to be estimated from paired sample data. From the way the model was built, the parameters and describe the linear relationship between and , so estimating these two parameters from paired sample data amounts to finding a suitable straight line such that, taken as a whole, the points representing the paired sample data are as close to it as possible.
Some students may think of measuring: first draw a line, measure the distances from the points to it, then move the line until the sum of the distances is smallest. Measuring the slope and intercept at that position gives a line, as in Figure 8.2-2.
Some students may think of choosing two points in the figure and drawing the line through them so that roughly the same number of points lie on each side of it, and taking that line as the one we want, as in Figure 8.2-3.
Other students may think of taking several pairs of points in the scatter plot, finding the equations of several lines, and then taking the mean of the slopes and the mean of the intercepts of these lines as the slope and intercept of the line we want, as in Figure 8.2-4.
You may like to try these methods out and see whether they really work.
These methods all make some sense, but they are hard to carry out, so we need a different approach.
First let us state the task more precisely: starting from the paired sample data, describe mathematically what "taken as a whole, the points are closest to the line" means.
A natural idea is to use the "distance" from a point to the line to describe how close the point is to the line, and then use the sum of all the "distances" to describe how close all the observed sample data are to the line. Let the pairs of sample data of two variables satisfying the simple linear regression model be , , , . From we get
Clearly, the smaller is, the smaller the "distance" between the point and the point , that is, the smaller the vertical distance from the sample data point to the line , as in Figure 8.2-5. In particular, means that the point is on the line.
So we can use the sum of these vertical distances,
to describe the "overall closeness" of the observed sample data to the line .
In practice, because absolute values make the calculation awkward, people usually describe the "overall closeness" by the sum of the squares of the vertical distances from the points to the line,
In this expression , are the known paired sample data, so is determined by and ; that is, it is a function of and . Because can also be written as , the sum of the squares of the random errors, the smaller it is the better, so we take the values of and that make smallest as the estimates of the intercept and the slope.
Next we use the paired sample data to find the and that make smallest.
Write , . Since
and
we have
Every term on the right-hand side is non-negative, and the first terms do not involve . So for to be smallest, must be , that is, . Then
This is a quadratic function of , so is smallest exactly when
In summary, is smallest when and take the values
Related points
All points in this topicCite this page: Derivation of the least-squares estimates · KnowledgeTree (知识树), https://www.knowledgetree.world/en/kp/KP000948