The Principle and Application of the Least Squares Regression Line | 最小二乘回归线的原理与运用

📚 The Principle and Application of the Least Squares Regression Line | 最小二乘回归线的原理与运用

In the study of IB Mathematics, the least squares regression line is a fundamental tool for modelling the relationship between two variables. It provides a systematic way to find the line of best fit through a set of data points, minimising the overall error of prediction.

在 IB 数学的学习中,最小二乘回归线是建模两个变量之间关系的基本工具。它提供了一种系统的方法,通过一组数据点找到最佳拟合直线,从而最小化整体预测误差。


1. What is Regression? | 什么是回归?

Regression analysis is used to examine the relationship between an independent variable (usually denoted as x) and a dependent variable (denoted as y). When the relationship appears approximately linear, we can use a straight line to summarise the trend in the data.

回归分析用于研究自变量(通常记为 x)与因变量(记为 y)之间的关系。当这种关系大致呈线性时,我们可以用一条直线来概括数据中的趋势。

The equation of the least squares regression line is written as:

y = a + bx

where \(a\) is the y-intercept and \(b\) is the slope. In IB Mathematics, you are expected to interpret these values in context.

最小二乘回归线的方程写作:

y = a + bx

其中 a 为 y 截距,b 为斜率。在 IB 数学中,你需要结合具体情境解释这些值的意义。


2. The Least Squares Criterion | 最小二乘准则

The “least squares” method chooses the line that minimises the sum of the squares of the vertical distances from each data point to the line. These vertical distances are called residuals.

“最小二乘”方法选择一条直线,使每个数据点到该直线的竖直距离的平方和最小。这些竖直距离被称为残差。

If the data points are (xᵢ, yᵢ) and the predicted value from the line is ŷᵢ = a + bxᵢ, then the residual is eᵢ = yᵢ − ŷᵢ. The objective is to minimise:

S = Σ(yᵢ − ŷᵢ)² = Σ(yᵢ − a − bxᵢ)²

Why do we use squares? Squaring ensures that positive and negative residuals do not cancel each other out. It also gives more weight to larger errors, making the line sensitive to outliers.

如果数据点为 (xᵢ, yᵢ),回归线预测值为 ŷᵢ = a + bxᵢ,则残差为 eᵢ = yᵢ − ŷᵢ。目标是最小化:

S = Σ(yᵢ − ŷᵢ)² = Σ(yᵢ − a − bxᵢ)²

为什么使用平方?因为平方可以避免正负残差相互抵消。同时它赋予较大误差更多权重,从而使直线对异常值更加敏感。


3. Deriving the Formulas for a and b | 推导 a 和 b 的公式

By using calculus, we can find the values of a and b that minimise S. Taking partial derivatives of S with respect to a and b and setting them to zero gives two normal equations.

通过微积分,我们可以找到使 S 最小的 a 和 b 的值。分别对 a 和 b 求偏导数并令其为零,可以得到两个正规方程。

After simplifying, the slope b is given by:

b = Σ(xᵢ − x̄)(yᵢ − ȳ) / Σ(xᵢ − x̄)²

where x̄ and ȳ are the means of x and y respectively. The intercept a is then calculated as:

a = ȳ − bx̄

This shows that the least squares regression line always passes through the point (x̄, ȳ), the centroid of the data.

化简后,斜率 b 的公式为:

b = Σ(xᵢ − x̄)(yᵢ − ȳ) / Σ(xᵢ − x̄)²

其中 x̄ 和 ȳ 分别为 x 和 y 的均值。截距 a 再由下式得出:

a = ȳ − bx̄

这说明最小二乘回归线总是经过数据点的质心 (x̄, ȳ)。


4. Interpreting the Slope and Intercept | 解释斜率和截距

The slope b represents the average change in y for a one-unit increase in x. For example, if y is exam score and x is hours of study, then b is the expected increase in score per extra hour studied.

斜率 b 表示 x 每增加一个单位,y 的平均变化量。例如,如果 y 是考试成绩,x 是学习小时数,则 b 表示每小时额外学习所导致的成绩预期增加量。

The intercept a is the predicted value of y when x = 0. It may or may not have a meaningful interpretation in context. If x = 0 is outside the range of the data, the intercept is often just a mathematical construct.

截距 a 是当 x = 0 时 y 的预测值。它在具体情境中可能具有意义,也可能没有意义。如果 x = 0 不在数据范围内,截距通常只是一个数学构造。

Remember: the regression line should only be interpreted within the observed range of x, unless you have strong evidence that the relationship continues outside that range.

请记住:回归线只应在 x 的观测范围内进行解释,除非你有充分证据表明该关系在范围之外仍然成立。


5. Residuals and Their Properties | 残差及其性质

Residuals measure the difference between observed and predicted values. A residual plot helps assess whether a linear model is appropriate.

残差衡量观测值与预测值之间的差异。残差图有助于判断线性模型是否合适。

Key properties of residuals from the least squares regression line are:

  • The sum of the residuals is zero: Σeᵢ = 0.
  • The mean of the residuals is zero.
  • The residuals have no correlation with the explanatory variable x.

If the residual plot shows a random scatter around zero, the linear model is appropriate. If a pattern appears, a non-linear model may be better.

最小二乘回归线残差的关键性质有:

  • 残差之和为零:Σeᵢ = 0。
  • 残差的均值为零。
  • 残差与解释变量 x 不相关。

如果残差图围绕零随机散布,则线性模型合适。如果出现明显模式,则可能需要非线性模型。


6. Relationship with Correlation Coefficient | 与相关系数的关系

The Pearson correlation coefficient r measures the strength and direction of a linear relationship between two variables. The least squares slope is closely linked to r:

皮尔逊相关系数 r 衡量两个变量之间线性关系的强度和方向。最小二乘斜率与 r 密切相关:

b = r × (sᵧ / sₓ)

where sₓ and sᵧ are the sample standard deviations of x and y. The sign of b is always the same as the sign of r.

其中 sₓ 和 sᵧ 分别是 x 和 y 的样本标准差。b 的符号与 r 的符号总是一致的。

The coefficient of determination, r², represents the proportion of the variance in y that is explained by the linear relationship with x. For example, if r = 0.8, then r² = 0.64, meaning 64% of the variation in y is explained by x.

决定系数 r² 表示 y 的变异中被 x 的线性关系所解释的比例。例如,若 r = 0.8,则 r² = 0.64,意味着 y 中 64% 的变异可由 x 解释。


7. Using the Line for Prediction | 使用回归线进行预测

Once the regression line is established, it can be used to predict y for a given x. This is called interpolation if the x value lies within the range of the original data, and extrapolation if it lies outside that range.

回归线建立后,可用于对给定的 x 预测 y。如果 x 值位于原始数据范围内,这称为内插;如果位于范围外,则称为外推。

Interpolation is generally more reliable because the linear relationship has been observed in that region. Extrapolation is risky because the relationship may change outside the data range.

内插通常更可靠,因为该区域内的线性关系已经过观测。外推是有风险的,因为数据范围之外的关系可能发生变化。

For example, if a regression line models the height of a plant over time based on weeks 1 to 10, predicting height at week 12 is extrapolation and should be treated with caution.

例如,如果回归线根据第 1 周到第 10 周的数据建模植物高度,那么预测第 12 周的高度属于外推,应谨慎对待。


8. Assumptions and Limitations | 假设与局限

The least squares regression line is based on several assumptions about the data:

  • The relationship between x and y is linear, at least approximately.
  • The data are free of significant outliers, which can heavily influence the line.
  • The x values are measured without error (or at least, errors in x are negligible compared to errors in y).

最小二乘回归线基于关于数据的若干假设:

  • x 与 y 之间的关系是线性的,至少近似线性。
  • 数据中没有显著异常值,因为异常值会严重影响回归线。
  • x 值的测量误差可以忽略不计(或者至少与 y 的误差相比很小)。

In reality, these assumptions are often violated. Always check a scatter plot and residual plot before trusting the regression results. The least squares method is also sensitive to outliers; removing an outlier can drastically change the slope and intercept.

现实中这些假设经常被违反。在信任回归结果之前,务必检查散点图和残差图。最小二乘法对异常值也很敏感;移除一个异常值可能会显著改变斜率和截距。


9. Worked Example | 完整例题

The following data shows the number of hours studied (x) and the corresponding test score (y) for five students:

以下数据展示了五名学生的小时学习量 (x) 和对应测试分数 (y):

x (hours) 2 4 6 8 10
y (score) 50 55 62 70 78

Calculate the least squares regression line and predict the score for 7 hours of study.

计算最小二乘回归线,并预测学习 7 小时的分数。

First compute the means: x̄ = (2+4+6+8+10)/5 = 6, ȳ = (50+55+62+70+78)/5 = 63.

首先计算均值:x̄ = (2+4+6+8+10)/5 = 6,ȳ = (50+55+62+70+78)/5 = 63。

Now compute Σ(xᵢ − x̄)(yᵢ − ȳ) and Σ(xᵢ − x̄)²:

现在计算 Σ(xᵢ − x̄)(yᵢ − ȳ) 和 Σ(xᵢ − x̄)²:

xᵢ − x̄ −4 −2 0 2 4
yᵢ − ȳ −13 −8 −1 7 15
product 52 16 0 14 60
(xᵢ − x̄)² 16 4 0 4 16

Thus Σ product = 52+16+0+14+60 = 142 and Σ(xᵢ − x̄)² = 16+4+0+4+16 = 40.

因此 Σ 乘积 = 52+16+0+14+60 = 142,Σ(xᵢ − x̄)² = 16+4+0+4+16 = 40。

Hence b = 142/40 = 3.55, and a = ȳ − bx̄ = 63 − 3.55 × 6 = 63 − 21.3 = 41.7.

因此 b = 142/40 = 3.55,a = ȳ − bx̄ = 63 − 3.55 × 6 = 63 − 21.3 = 41.7。

So the regression line is y = 41.7 + 3.55x. For x = 7, predicted score ŷ = 41.7 + 3.55 × 7 = 41.7 + 24.85 = 66.55.

所以回归线为 y = 41.7 + 3.55x。当 x = 7 时,预测分数 ŷ = 41.7 + 3.55 × 7 = 41.7 + 24.85 = 66.55。


10. Common Mistakes and Exam Tips | 常见错误与考试技巧

Students often make avoidable errors when working with the least squares regression line. Being aware of these can help you secure full marks in IB exams.

学生在使用最小二乘回归线时经常犯一些可以避免的错误。了解这些错误有助于你在 IB 考试中获得满分。

  • Switching variables: The regression line of y on x is different from the regression line of x on y. Always identify which variable is being predicted.
  • Using the wrong formula: Ensure you use the correct expression for the slope. In IB, the formula booklet gives: b = Σ(xᵢ − x̄)(yᵢ − ȳ) / Σ(xᵢ − x̄)².
  • Rounding too early: Keep at least three significant figures during intermediate steps to avoid rounding errors in the final answer.
  • Ignoring context: Always interpret the slope and intercept in the context of the question, using correct units.
  • 变量混淆:y 对 x 的回归线与 x 对 y 的回归线不同。务必确定哪一个变量是被预测的。
  • 使用错误公式:确保使用正确的斜率表达式。在 IB 中,公式册给出的公式为:b = Σ(xᵢ − x̄)(yᵢ − ȳ) / Σ(xᵢ − x̄)²。
  • 过早四舍五入:在中间步骤中至少保留三位有效数字,以避免最终答案产生舍入误差。
  • 忽略情境:务必结合问题情境解释斜率和截距,并使用正确的单位。

In exam questions, you may be asked to find the regression line using your GDC (graphical display calculator). Remember to write the equation in the form y = a + bx, and state the values of a and b to a reasonable degree of accuracy.

在考试题目中,你可能需要使用图形计算器(GDC)求回归线。记得将方程写成 y = a + bx 的形式,并以合理的精度写出 a 和 b 的值。


11. Summary and Conclusion | 总结与结论

The least squares regression line is a powerful statistical tool that allows us to model linear relationships, interpret them in context, and make predictions. Its principle is to minimise the sum of squared residuals, and its formulas are derived from this criterion.

最小二乘回归线是一个强大的统计工具,它使我们能够对线性关系建模、结合情境解释关系并进行预测。其原理是最小化残差平方和,而其公式正是由这一准则推导出来的。

To apply this tool correctly in IB Mathematics, remember: check the scatter plot, interpret the slope and intercept, use interpolation carefully, and always be mindful of outliers and the assumptions of linear regression.

要在 IB 数学中正确运用这一工具,请记住:检查散点图、解释斜率和截距、谨慎使用内插,并始终注意异常值以及线性回归的假设条件。

Mastering these concepts will not only help you score well in exams but also prepare you for future studies in statistics and data science.

掌握这些概念不仅有助于你在考试中取得好成绩,也为将来学习统计学和数据科学打下基础。


Published by TutorHao | Mathematics Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading