← 返回资讯屏轩教育 · 行业资讯

Linear Regression: Least Squares Line, Correlation and Prediction | 线性回归:最小二乘直线、相关与预测

2026-08-29 16:55 · 本文部分内容由AI辅助创作

📚 Linear Regression: Least Squares Line, Correlation and Prediction | 线性回归:最小二乘直线、相关与预测

Linear regression is a fundamental statistical tool in the Edexcel A-Level Mathematics specification. It allows you to model the linear relationship between two variables, make predictions, and assess the strength of association between them using the product moment correlation coefficient.

线性回归是 Edexcel A-Level 数学大纲中的基础统计工具。它可以帮助你对两个变量之间的线性关系建模、进行预测,并通过积矩相关系数评估两者之间关联的强度。

In this revision guide you will meet the full specification content: the least squares regression line, the summary statistics Sxx, Syy and Sxy, the formulae for the gradient and intercept, the product moment correlation coefficient r, residuals, interpolation and extrapolation, and the standard interpretation marks that examiners look for.

在本篇复习指南中,你会系统覆盖考纲的全部内容:最小二乘回归直线、汇总量 Sxx、Syy 与 Sxy、斜率与截距公式、积矩相关系数 r、残差、内插与外推,以及考官特别关注的"解释性得分点"。


1. What Is Linear Regression? | 什么是线性回归?

In a bivariate data set, one variable is treated as the explanatory (independent) variable x and the other as the response (dependent) variable y. Linear regression finds the straight line that best describes how y changes with x, assuming the scatter diagram shows a roughly linear pattern.

在双变量数据集中,一个变量作为解释变量(自变量)x,另一个作为响应变量(因变量)y。线性回归寻找一条最能描述 y 随 x 变化规律的直线,前提是散点图大致呈线性趋势。

The regression line of y on x is used when we want to predict values of y from known values of x. It is not the same as the regression line of x on y, which is used to predict x from y. The two lines are different straight lines and they only coincide in the special case of perfect correlation.

y 对 x 的回归直线用于从已知的 x 值预测 y 值。它与 x 对 y 的回归直线不是同一条线——后者用于从 y 预测 x。这两条是不同直线,只有在完全相关的特殊情况下才会重合。

Both regression lines pass through the mean point (x̄, ȳ). This is an important property: any valid regression line must satisfy this condition, and it gives you a quick check on your calculations.

两条回归直线都经过均值点 (x̄, ȳ)。这是一个重要性质:任何合法的回归直线都必须满足这一点,也为你提供了一个快速验算的手段。

Regrettably, many students lose marks by confusing the two directions. Always read the question carefully: "predict the value of y given x" means use the line of y on x, not the other one.

遗憾地说,很多学生因为混淆了两个方向而失分。请务必仔细读题:题目说"已知 x 预测 y",就要用 y 对 x 的回归直线,而不是另一条。


2. The Least Squares Regression Line | 最小二乘回归直线

The best-fitting straight line is obtained by the method of least squares. We minimise the sum of the squares of the vertical residuals, where a residual is the difference between an observed y value and the predicted y value from the line.

最佳拟合直线通过最小二乘法获得。我们要最小化纵向残差的平方和,其中残差是实际观测值 y 与直线预测值之差。

For the regression line of y on x, the predicted value is written as ŷ = a + bx, and the residual for each point is eᵢ = yᵢ − ŷᵢ. Minimising Σeᵢ² gives the least squares estimates for a and b.

对于 y 对 x 的回归直线,预测值记为 ŷ = a + bx,每个点的残差为 eᵢ = yᵢ − ŷᵢ。最小化 Σeᵢ² 就能得到 a 与 b 的最小二乘估计。

ŷ = a + bx

Why square the residuals rather than just add them? through the mean point. Squaring removes the signs and penalises large errors more heavily, giving a unique line that no other straight line can beat.

为什么要把残差平方,而不是直接相加?因为正负残差会相互抵消,对于任何经过均值点的直线都有 Σeᵢ = 0。平方可以消除符号影响,并且更严厉地惩罚大误差,从而给出唯一一条"任何其他直线都无法超越"的最优直线。

The word "vertical" matters. The line of y on x minimises vertical distances, because it predicts y for a given x. The line of x on y minimises horizontal distances instead. This is the geometric reason the two lines differ.

"纵向"这个词很关键。y 对 x 的直线最小化的是纵向距离,因为它是在给定 x 时预测 y;而 x 对 y 的直线最小化的则是横向距离。这正是两条直线不同的几何原因。


3. Key Formulae for Edexcel | Edexcel 关键公式

Given n pairs of data (xᵢ, yᵢ), the summary quantities Sxx, Syy and Sxy are calculated first. These quantities measure the variability of x, the variability of y, and the joint variability of x and y.

给定 n 对数据 (xᵢ, yᵢ),首先计算汇总量 Sxx、Syy 和 Sxy。这些量分别衡量 x 的变异、y 的变异以及 x 和 y 的联合变异。

Sxx = Σx² − (Σx)² ÷ n

Syy = Σy² − (Σy)² ÷ n

Sxy = Σxy − (Σx)(Σy) ÷ n

These three formulas are given in the Edexcel formula booklet, but you must know how to use them fluently. Note that Sxx and Syy are always non-negative, while Sxy can be positive, negative or zero.

这三个公式在 Edexcel 公式册中都有给出,但你必须能够熟练使用。注意 Sxx 与 Syy 永远非负,而 Sxy 可正、可负、也可以为零。

The gradient and intercept of the regression line of y on x follow directly from these quantities, together with the means x̄ and ȳ.

y 对 x 的回归直线的斜率与截距可以直接由这些量以及均值 x̄、ȳ 得到。

b = Sxy ÷ Sxx      a = ȳ − b x̄

of x on y, the roles are swapped: the gradient is d = Sxy ÷ Syy and the intercept is c = x̄ − d ȳ, giving x = c + dy.

对于 x 对 y 的回归直线,角色互换:斜率为 d = Sxy ÷ Syy,截距为 c = x̄ − d ȳ,即 x = c + dy。

For the product moment correlation coefficient between x and y, the formula is the ratio of joint variability to the geometric mean of the two individual variabilities.

对于 x 与 y 之间的积矩相关系数,其公式是联合变异与两个单独变异的几何平均之比。

r = Sxy ÷ √Sxx × Syy


4. Step-by-Step Calculation Method | 分步计算方法

hen total each column. Step 2: compute Sxx, Syy and Sxy using the formulas. Step 3: find x̄ = Σx ÷ n and ȳ ation in the form y = a + bx, using the context variables rather than the letters x and y.

第一步:把数据列成表格,增加 x²、y²、xy 三列并分别求和。第二步:用公式计算 Sxx、Syy 与 Sxy。第三步:求 x̄ = Σx ÷ n 与 ȳ = Σy ÷ n。第四步:先算 b,再算 a,最后用题目中的实际变量名(而不是字母 x、y)写出形如 y = a + bx 的方程。

Work to at least four significant figures throughout and only round at the final stage. Excessive early rounding is one of the most common sources of lost accuracy marks in this topic.

整个过程中至少保留四位有效数字,只在最后一步取整。过早四舍五入是本科目失分最常见的原因之一。

Always check that your line passes through (x̄, ȳ). Substitute x̄ into your equation; the answer should equal ȳ apart from rounding. If it does not, there is an arithmetic error somewhere.

务必验证直线经过 (x̄, ȳ)。把 x̄ 代入方程,结果应当等于 ȳ(允许四舍五入误差)。如果不相等,说明某处算错了。

Examiners award method marks for correct Sxx, Sxy and b even if the final answer is wrong, so always show the substitution explicitly rather than jumping straight to a calculator answer.

即使最终答案错误,只要 Sxx、Sxy 和 b 的算法正确,考官仍会给方法分。因此务必写出代入过程,不要直接跳到计算器结果。


5. A Complete Worked Example | 一个完整例题

observations: x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 8, 11. We build the working table below.

假设有 5 组观测数据:x = 1, 2, 3, 4, 5,y = 2, 4, 5, 8, 11。我们建立如下计算表。

x y x² y² xy
1 2 1 4 2
2 4 4 16 8
3 5 9 25 15
4 8 16 64 32
5 11 25 121 55
Σx = 15 Σy = 30 Σx² = 55 Σy² = 230 Σxy = 112

With n = 5, x̄ = 3 and ȳ hen Sxx = 55 − 225 ÷ 5 = 10, Syy = 230 − 900 ÷ 5 = 50, and Sxy = 112 − (15 × 30) ÷ 5 = 22.

由于 n = 5,可得 x̄ = 3,ȳ = 6。于是 Sxx = 55 − 225 ÷ 5 = 10,Syy = 230 − 900 ÷ 5 = 50,Sxy = 112 − (15 × 30) ÷ 5 = 22。

herefore b = 22 ÷ 10 = 2.2 and a = 6 − 2.2 × 3 = −0.6, so the regression line of y on x is ŷ = −0.6 + 2.2x.

因此 b = 22 ÷ 10 = 2.2,a = 6 − 2.2 × 3 = −0.6,所以 y 对 x 的回归直线为 ŷ = −0.6 + 2.2x。

The correlation coefficient is r = 22 ÷ √10 × 50 cating a very strong positive linear correlation. Squaring gives r² ≈ 0.968, so about 96.8% of the variation in y is explained by the linear model in x.

广告 / Sponsored

相关系数为 r = 22 ÷ √10 × 50 = 22 ÷ 22.361 ≈ 0.984,表明存在非常强的正线性相关。平方得 r² ≈ 0.968,即 y 中约 96.8% 的变异可由 x 的线性模型解释。


6. Interpreting the Gradient and Intercept | 解释斜率与截距

d it is only meaningful if x = 0 lies within the observed data range or has a sensible physical interpretation.

在方程 y = a + bx 中,斜率 b 表示 x 每增加一个单位时 y 的预测变化量;截距 a 是 x = 0 时 y 的预测值,只有当 x = 0 落在观测数据范围内、或具有合理的实际意义时,解释截距才是有意义的。

Interpretation marks require context. Instead of writing "the gradient is 2.2", write "for every additional unit increase in x, the predicted value of y increases by 2.2 units on average". Always name the real variables from the question.

解释性得分必须结合题目背景。不要写"斜率是 2.2",而要写"x 每增加一个单位,y 的预测值平均增加 2.2 个单位"。并且要用题目中的实际变量名称。

If the intercept has no sensible interpretation - for example, a negative intercept when y must be positive - say so explicitly. Examiners reward the recognition that the model is only valid over the observed range.

如果截距没有合理意义——例如 y 本身必须为正却算出负截距——就明确指出来。考官会给这种"意识到模型只在观测范围内有效"的判断加分。

A common exam question asks for the predicted value of y for a given x. Simply substitute the value into your regression equation and state the answer with appropriate units and rounding.

常见考题会给出某个 x 值,要求预测 y。只需把该值代入回归方程,并写出带单位、合理取整的答案即可。


7. The Product Moment Correlation Coefficient | 积矩相关系数

The product moment correlation coefficient r measures the strength and direction of linear association between two variables. It always lies between −1 and +1 inclusive.

积矩相关系数 r 衡量两个变量之间线性关联的强度与方向。它的取值始终在 −1 与 +1 之间(含端点)。

ns no linear correlation at all. Values close to ±1 indicate a strong linear relationship.

r = +1 表示完全正线性相关,r = −1 表示完全负线性相关,r = 0 表示完全没有线性相关。接近 ±1 的取值表示线性关系很强。

Important: r is a measure of linear association only. A strong curved relationship can still produce an r value near zero, so always examine the scatter diagram before quoting r.

重要提示:r 只度量线性关联。一个很强的曲线关系仍可能给出接近 0 的 r 值,所以在引用 r 之前一定要先看散点图。

The sign of r is always the same as the sign of the gradient b, because both share the factor Sxy. Also note that r is unchanged if the units are changed, since scaling both variables cancels out in the formula.

r 的符号与斜率 b 的符号必然一致,因为两者都含有因子 Sxy。另外注意,改变单位不会改变 r 的值,因为两个变量的缩放会在公式中相互抵消。

In the Edexcel specification, r is also used in hypothesis testing. You compare the observed value of r with a critical value from the tables at a given significance level, using the correct one-tailed or two-tailed test.

在 Edexcel 考纲中,r 还用于假设检验。你需要把观测到的 r 值与给定显著性水平下的临界值表比较,并正确选择单尾或双尾检验。


8. Interpolation and Extrapolation | 内插与外推

Interpolation means predicting within the range of the observed x values. These predictions are generally reliable because the model has been fitted to data in that region.

内插是指在观测到的 x 值范围内进行预测。这类预测通常比较可靠,因为模型正是基于该区域的数据拟合出来的。

Extrapolation means predicting outside the observed range. This is unreliable because there is no evidence that the linear pattern continues beyond the data, and in real contexts the relationship may change or break down entirely.

外推是指在观测范围之外进行预测。这种预测不可靠,因为没有证据表明线性规律在数据范围之外仍然成立;在实际背景下,关系可能发生变化甚至完全失效。

Exam answers that require judgement should state clearly that extrapolation is risky and explain why, referring to the data range or the physical context.

需要判断的考题答案应明确指出外推有风险,并解释原因,可以结合数据范围或实际背景来说明。

A typical mark scheme sentence looks like: " as x = 20 is outside the range of observed values, so the prediction may not be reliable."

典型的标准答案句式是:"这属于外推,因为 x = 20 超出了观测值范围,所以该预测可能不可靠。"


9. Residuals and Goodness of Fit | 残差与拟合优度

dual is the vertical distance between an observed point and the regression line: eᵢ = yᵢ − ŷ ive residual means the point lies above the line; a negative residual means it lies below.

残差是观测点与回归直线之间的纵向距离:eᵢ = yᵢ − ŷᵢ。残差为正表示点位于直线上方,为负表示位于直线下方。

For our worked example the residuals are 0.4, 0.2, −1.0, −0.2 and 0.6, giving Σeᵢ² = 1.60.

对于最小二乘直线,残差之和恒为 0,且残差平方和 Σeᵢ² 达到最小。在我们的例题中,残差为 0.4、0.2、−1.0、−0.2、0.6,因此 Σeᵢ² = 1.60。

Plotting residuals against x is a standard diagnostic. If the residual plot shows a random scatter with no pattern, the linear model is appropriate. If it shows a curve, the relationship is probably not linear.

把残差对 x 作图是标准诊断方法。如果残差图呈无规律的随机散布,说明线性模型合适;如果呈曲线趋势,说明关系很可能不是线性的。

The coefficient of determination r² tells you the proportion of the total variation in y that is explained by the regression on x. It is a useful summary of goodness of fit, ranging from 0 to 1.

决定系数 r² 表示 y 的总变异中被 x 的回归所解释的比例,是衡量拟合优度的有用指标,取值范围为 0 到 1。


10. Common Exam Mistakes | 常见考试错误

Mistake 1: using the wrong regression line. If the question asks for x in terms of y, you must use the line of x on y, with gradient Sxy ÷ Syy. Swapping the variables does not give the same line.

错误一:用错回归直线。如果题目要以 y 表示 x,就必须使用 x 对 y 的直线,其斜率为 Sxy ÷ Syy。互换变量并不会得到同一条直线。

Mistake 2: rounding intermediate values. Keep full accuracy in Sxx, Sxy, b and a, and round only the final quoted equation.

错误二:中间步骤过早四舍五入。Sxx、Sxy、b、a 都要保留完整精度,只对最终写出的方程取整。

Mistake 3: claiming causation. A high value of r shows association, not that one variable causes the other. A lurking variable may explain both.

错误三:把相关说成因果。r 值高只说明有关联,并不表示一个变量导致了另一个。可能存在同时影响两者的隐藏变量。

Mistake 4: forgetting the context. Interpretation marks are awarded for statements about the actual variables, with units, not for abstract comments about x and y.

错误四:忽略题目背景。解释性得分要求你针对实际变量、带单位地陈述,而不是抽象地谈论 x 和 y。

Mistake 5: quoting r without justification. When asked to comment on the suitability of a linear model, refer to the scatter diagram, the value of r and the residual plot together.

错误五:不加论证地引用 r。当题目要求评价线性模型是否适当时,应同时参考散点图、r 值以及残差图。


11. Calculator Tips and Exam Checklist | 计算器技巧与考场清单

A and B. On a TI-Nspire CX II, store the data in two list columns and use Statistics > Stat Calculations > Linear Regression (a + bx).

在 Casio fx-991 ClassWiz 上,进入统计模式输入数据,选择 y = a + bx 回归模型,读出 A 与 B。在 TI-Nspire CX II 上,把数据存入两列列表,使用 Statistics > Stat Calculations > Linear Regression (a + bx)。

Remember that a calculator answer alone rarely earns full marks. Show the table totals, the values of Sxx, Sxy and b, then quote the equation. This secures the method marks even if a keying error occurs.

请记住,只写出计算器结果通常拿不到满分。要展示表格总和、Sxx、Sxy 与 b 的值,然后写出方程。这样即使按键出错,也仍能保住方法分。

Checklist before you leave the question: have you named the correct regression direction, kept four significant figures, verified the line passes through (x̄, ȳ), interpreted the gradient in context, and commented on the reliability of any prediction?

离开这道题之前请自查:回归方向选对了吗?是否保留了四位有效数字?直线是否经过 (x̄, ȳ)?斜率是否结合背景解释?对任何预测是否评价了可靠性?

广告 / Sponsored
培生爱德思考试教材 统计数学3 Edexcel International A Level Mathematics S…
数学 备考教辅 · 正版现货 · 与本文内容相关
查看详情 / View on Taobao参考价 ¥156.0

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

备考资讯每日更新,关注不错过
考纲变化 · 科目分析 · 学习方法
扫码关注公众号 tutorhao
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图
公众号:tutorhao