📚 Linear Regression | 线性回归
Linear regression is a fundamental statistical technique used to model the relationship between two numerical variables by fitting a straight line to observed data. In the context of Edexcel A‑Level Mathematics, understanding how to calculate, interpret, and validate a regression line is essential for analysing bivariate data and making informed predictions.
线性回归是一种基础统计技术,通过对观测数据拟合一条直线来模拟两个数值变量之间的关系。在 Edexcel A‑Level 数学中,掌握如何计算、解释和验证回归直线对于分析双变量数据以及做出合理预测至关重要。
1. Introduction to Linear Regression | 线性回归简介
ar association between an explanatory variable (often denoted x) and a response variable (y). The goal is to find a straight‑ best summarises the trend in the data. This model helps us understand how a unit change in x affects y, on average.
线性回归研究解释变量(通常记作 x)与响应变量(y)之间的线性关系。目标是要找到一个形如 y = a + bx 的直线方程,用以最好地概括数据中的趋势。这个模型能帮助我们理解,平均而言,x 每变化一个单位时 y 会如何变化。
The regression line is not simply drawn by eye; it is determined mathematically using the method of least squares. Edexcel requires students to compute the regression coefficients, interpret their meaning in context, and use the equation for prediction within the range of the observed data.
回归直线并非仅凭目测画出,而是通过数学方法——最小二乘法——严格确定的。Edexcel 要求学生能够计算回归系数、结合具体情境解释其含义,并在观测数据范围内使用方程进行预测。
2. The Least Squares Method | 最小二乘法
The least squares method finds the line that minimises the sum of the squared vertical distances (residuals) from each data point to the line. If we let Sxx = Σ(x − x̄)² and Sxy = Σ(x − x̄)(y − ȳ), the slope b of the regression line y = a + bx is given by:
最小二乘法寻找的是使每个数据点到直线的垂直距离(残差)的平方和最小的那条直线。若令 Sxx = Σ(x − x̄)² 且 Sxy = Σ(x − x̄)(y − ȳ),则回归直线 y = a + bx 的斜率 b 由下式给出:
b = Sxy / Sxx
The intercept a can then be calculated using the means of x and y:
截距 a 则可通过 x 与 y 的均值计算得到:
a = ȳ − b x̄
These formulas arise from setting the partial derivatives of the sum of squared residuals to zero, ensuring that the line is the unique best linear unbiased estimator under certain assumptions. In Edexcel exams, you may be given summary statistics such as Σx, Σy, Σx², Σy², Σxy and n, from which Sxx and Sxy can be derived.
这些公式源于将残差平方和对参数的偏导数设为零,确保在特定假设下,该直线是唯一的最佳线性无偏估计。在 Edexcel 考试中,可能会给出总结统计量,如 Σx、Σy、Σx²、Σy²、Σxy 和 n,由此可推导出 Sxx 和 Sxy。
3. Calculating the Regression Line | 计算回归直线
o find the equation of the regression line, follow these steps: first, compute the means x̄ = Σx / n and ȳ = Σy / n. Next, calculate Sxx = Σx² − (Σx)² / n and Sxy = Σxy − (Σx)(Σy) / n. Then, determine the slope b = Sxy / Sxx and the intercept a = ȳ − b x̄. Finally, write the line as y = a + bx, where y is the predicted response for a given x.
要求得回归直线方程,可遵循以下步骤:首先计算均值 x̄ = Σx / n 和 ȳ = Σy / n。接着计算 Sxx = Σx² − (Σx)² / n 以及 Sxy = Σxy − (Σx)(Σy) / n。然后求出斜率 b = Sxy / Sxx 和截距 a = ȳ − b x̄。最后将直线写为 y = a + bx,其中 y 表示给定 x 下响应变量的预测值。
Be careful to distinguish between the regression line of y on x (used when y is the response) and the regression line of x on y. The Edexcel specification typically focuses on y on x, which minimises vertical deviations. Always check which variable is the dependent variable in the question.
注意区分 y 对 x 的回归直线(当 y 为响应变量时使用)与 x 对 y 的回归直线。Edexcel 大纲通常重点考察 y 对 x 的情形,此时最小化的是垂直偏差。做题时务必确认哪个变量是因变量。
For example, given data on temperature (x, °C) and ice cream sales (y, £), the regression equation allows a vendor to predict sales for a given temperature. If Sxx = 240 and Sxy = 180, with x̄ = 20, ȳ = 350, then b = 180/240 = 0.75 and a = 350 − 0.75 × 20 = 335, yielding y = 335 + 0.75x.
例如,给定温度(x,°C)和冰激凌销售额(y,英镑)的数据,回归方程能帮助摊贩针对给定温度预测销售额。若 Sxx = 240,Sxy = 180,且 x̄ = 20,ȳ = 350,则 b = 180/240 = 0.75,a = 350 − 0.75 × 20 = 335,得到 y = 335 + 0.75x。
4. Interpreting the Slope and Intercept | 解释斜率和截距
The slope b represents the estimated change in the response variable y for each one‑ del relating study hours (x) to test scores (y), we would say that for every additional hour studied, the test score is expected to increase by 2.5 marks, on average.
斜率 b 表示解释变量 x 每增加一个单位时响应变量 y 的估计变化量。例如,若在描述学习时间(x)与测试成绩(y)的模型中 b = 2.5,则可以说平均而言,每多学习一小时,测试成绩预计提高 2.5 分。
close to the range of the observed data. In the test score example, an intercept of 40 would mean a student with zero study hours is predicted to score 40; this makes sense only if such a scenario is plausible.
截距 a 是当 x = 0 时 y 的预测值。不过,只有当 x = 0 位于观测数据范围内或接近该范围时,这个值才有实际意义。在测试成绩的例子中,截距为 40 意味着零学习时数的学生预计得 40 分;只有在这样的场景合理时,该解释才成立。
Always interpret the coefficients in the context of the problem, and give units. For example, "the slope of 0.75 means that for every 1°C increase in temperature, ice cream sales rise by £0.75, on average." Avoid causal language unless supported by experimental design.
请始终结合问题背景解释回归系数,并附上单位。例如,“斜率为 0.75 意味着气温每升高 1°C,冰激凌销售额平均增加 0.75 英镑。”除非实验设计支持,否则避免使用因果性语言。
5. Residuals and Goodness of Fit | 残差与拟合优度
A residual is the difference between an observed y‑value and the corresponding predicted value from the regression line: residual = y − ŷ esidual means the observed value is above the line; a negative residual means it is below.
残差是指观测到的 y 值与回归直线对应预测值之间的差异:残差 = y − ŷ。残差衡量实际数据点偏离拟合直线的程度。正残差表示观测值位于直线上方;负残差表示观测值位于直线下方。
Examining residuals helps assess how well the linear model fits the data. If the residuals display no obvious pattern and are randomly scattered around zero across the range of x, the linear model is appropriate. Patterns such as a curve or fan shape suggest that a linear relationship may not be the best description.
检查残差有助于评估线性模型对数据的拟合程度。若残差无明显模式,且在 x 的整个范围内随机散布于零附近,则线性模型是合适的。若出现弯曲或喇叭状等模式,则意味着线性关系可能并非最佳描述。
The sum of the residuals is always zero for a least‑squares regression line. The residual sum of squares (RSS = Σ(y − ŷ xcel questions may ask you to calculate a residual or comment on a residual plot provided.
最小二乘回归直线的残差总和始终为零。残差平方和(RSS = Σ(y − ŷ)²)被最小化。Edexcel 考题可能会要求你计算某个残差,或对给出的残差图进行评论。
6. The Correlation Coefficient | 相关系数
The product‑ ength and direction of the linear relationship between two variables. Its formula is r = Sxy / √Sxx Syy, where Syy = Σy² − (Σy)² / n. The value of r always lies between −1 and 1.
积矩相关系数(Pearson’s r)衡量两个变量之间线性关系的强度和方向。其公式为 r = Sxy / √Sxx Syy,其中 Syy = Σy² − (Σy)² / n。r 的值始终介于 −1 和 1 之间。
elation: as x increases, y tends to decrease. Values near 0 suggest little or no linear correlation. However, r only captures linear association; a perfectly quadratic relationship could yield r ≈ 0.
r 接近 +1 表示强正线性相关:随着 x 增大,y 倾向于增大。r 接近 −1 表示强负相关:随着 x 增大,y 倾向于减小。接近 0 的值表明几乎没有线性相关。但 r 只反映线性关联;一个完美的二次关系也可能产生 r ≈ 0。
In Edexcel papers, you are often required to calculate r from summary statistics and then interpret it in context, perhaps comparing it to a critical value from a table to test for significance. Remember that correlation does not imply causation.
在 Edexcel 试卷中,常要求你根据总结统计量计算 r,然后结合具体情境加以解释,有时还需要将其与表格中的临界值进行比较以检验显著性。请谨记,相关性不意味着因果关系。
7. Coefficient of Determination (R²) | 决定系数 R²
n the response variable y that can be explained by the explanatory variable x through the linear model. For example, if r = 0.8, then R² = 0.64, meaning 64% of the variation in y is accounted for by the linear relationship with x.
决定系数,记作 R²,就是相关系数的平方。它表示响应变量 y 的变异中可由解释变量 x 通过线性模型加以解释的比例。例如,若 r = 0.8,则 R² = 0.64,意味着 y 的变异有 64% 可由与 x 的线性关系解释。
R² is a useful measure of predictive power. A higher R² indicates that predictions from the regression line are more reliable, while a low R² suggests that the line does not capture much of the variability in y. However, a high R² does not guarantee that the model is appropriate; the residual plot must also be checked.
R² 是衡量预测能力的有用指标。较高的 R² 表明回归直线的预测更可靠,而较低的 R² 则意味着直线未能捕捉 y 的太多变异性。不过,高 R² 并不保证模型合适;还必须检查残差图。
8. Assumptions of Linear Regression | 线性回归的假设
Linear regression relies on several assumptions for the model to be valid. First, the relationship between x and y should be linear. This can be checked by a scatterplot and residual plot. Second, the residuals should have constant variance (homoscedasticity); the spread of residuals should be roughly the same across all values of x. Third, the residuals should be independent of each other, which is generally satisfied with random sampling.
线性回归依赖若干假设,模型才有效。第一,x 和 y 的关系应是线性的,这可通过散点图和残差图来检查。第二,残差应具有恒定方差(同方差性);残差的散布在 x 的所有取值范围内应大致相同。第三,残差之间应相互独立,随机抽样通常可以满足这一条件。
For inference beyond the A‑Level syllabus, normality of residuals is also assumed for hypothesis tests and confidence intervals. At Edexcel, you are mainly expected to recognise when a linear model is inappropriate by looking at a clearly curved pattern or a funnel shape in the residuals.
在超出 A‑Level 课程范围的推断中,进行假设检验和构建置信区间时还须假定残差服从正态分布。在 Edexcel 考试中,主要要求通过观察残差图中明显的弯曲模式或喇叭状分布来判断线性模型是否不合适。
When these assumptions are violated, the regression line may still be computed, but predictions and conclusions could be misleading. Always plot the data first.
当这些假设被违背时,回归直线仍可计算出来,但预测和结论可能产生误导。务必先画出数据图。
9. Making Predictions | 进行预测
Once a valid regression equation is established, it can be used to predict the value of y for a given x by substituting x into the equation. This is called interpolation when the x‑value lies within the range of the original data. Extrapolation, predicting for an x‑value outside the observed range, is risky because the linear relationship may not hold beyond the data.
一旦确立了有效的回归方程,就可以通过将 x 代入方程来预测给定 x 下 y 的值。当 x 值位于原始数据范围内时,称为内插。外推,即预测观测范围之外的 x 值,存在风险,因为线性关系在数据范围之外未必成立。
s recorded ranged from 15°C to 30°C, predicting sales at 25°C is interpolation (reasonable), but predicting at 5°C is extrapolation (unreliable). The relationship might change at very low temperatures—ice cream sales may drop sharply.
例如,使用冰激凌销售额模型 y = 335 + 0.75x,若记录的气温范围为 15°C 到 30°C,预测 25°C 时的销售额属于内插(合理),但预测 5°C 时则属于外推(不可靠)。在极低气温下,关系可能发生变化——冰激凌销售额可能急剧下降。
When making predictions, always state the limitations and recognise that predictions are estimates subject to uncertainty. Exam questions often ask for a prediction and then a comment on its reliability.
在进行预测时,务必说明其局限性,并认识到预测只是受不确定性影响的估计值。考题常要求先给出预测值,再对其可靠性加以评论。
10. Limitations and Cautions | 局限与注意事项
Linear regression is a powerful tool but has clear limitations. It only captures linear trends; non‑linear patterns require transformation or alternative models. Outliers can heavily influence the slope and intercept of the regression line, sometimes pulling the line toward themselves. Always identify and investigate outliers.
线性回归是一种有力的工具,但也有明显的局限性。它只能捕捉线性趋势;对于非线性模式,则需要进行变换或采用其他模型。异常值会极大地影响回归直线的斜率和截距,有时会将直线拉向自身。务必识别并探究异常值。
Another common mistake is confusing the regression line of y on x with that of x on y. If you mistakenly use the x‑on‑y line to predict y from x, you will obtain a biased predictor. The Edexcel specification expects you to know that for prediction of y, the y‑on‑x line is correct.
另一个常见错误是将 y 对 x 的回归直线与 x 对 y 的回归直线相混淆。如果误用 x 对 y 的直线由 x 预测 y,将得到有偏的预测值。Edexcel 大纲要求考生明白,若要对 y 进行预测,应使用 y 对 x 的直线。
Additionally, a high correlation does not imply that changes in x cause changes in y. Confounding variables may be responsible for the observed association. Always consider the context before drawing causal conclusions.
此外,高相关性并不意味着 x 的变化导致了 y 的变化。混杂变量可能才是所观测关联的真正原因。在下因果结论之前,永远要结合背景加以考量。
11. Using Logarithmic Transformations | 使用对数变换
Some non‑ hen allows linear regression to be applied. Two common cases are exponential models y = abˣ and power models y = axⁿ. Taking logs of both sides yields linear equations:
某些非线性关系可以通过对数变换转化为线性形式,从而应用线性回归。两种常见情形是指数模型 y = abˣ 和幂模型 y = axⁿ。对两边取对数可得到线性方程:
For y = abˣ: log y = log a + x log b (linear in x)
对于 y = abˣ:log y = log a + x log b(关于 x 线性)
For y = axⁿ: log y = log a + n log x (linear in log x)
对于 y = axⁿ:log y = log a + n log x(关于 log x 线性)
After performing the regression on the transformed data (e.g., log y vs. x, or log y vs. log x), the coefficients can be transformed back to obtain a and b (or a and n). This technique is particularly useful in modelling growth and decay, such as population growth or radioactive decay.
在对变换后的数据(如 log y 对 x,或 log y 对 log x)进行回归之后,可将系数反变换以求得 a 和 b(或 a 和 n)。这一技巧在建模增长与衰减(如种群增长或放射性衰变)时特别有用。
Edexcel questions may provide data and ask you to plot log y against x, assess linearity, and find the parameters of the original non‑linear model. You must be comfortable using the laws of logarithms and handling constant terms correctly.
Edexcel 的考题可能会提供数据,要求你绘制 log y 对 x 的图,评估线性程度,并求出原始非线性模型的参数。你必须熟练掌握对数运算规则,并能正确处理常数项。
12. Common Exam Pitfalls and Tips | 常见考试误区与提示
When solving linear regression problems, students often forget to use the correct formula for Sxx and Sxy, especially when summary data are given. Always write down the formulas first, then substitute carefully. Double‑check that you have used n, not n−1, for the variance‑type terms in these sums of squares, unless instructed otherwise.
解答线性回归问题时,学生常会忘记使用正确的 Sxx 和 Sxy 公式,特别是在给出汇总数据的情况下。务必先写下公式,再仔细代入。注意在这些平方和的计算中,除非另有说明,否则应使用 n 而非 n−1。
Another frequent mistake is mixing up the dependent and independent variables. The variable you wish to predict must be y. Also, when interpreting slope, include units and avoid definitive statements like “x causes y”. Use phrases such as “on average, a one‑unit increase in x is associated with an increase of b units in y”.
另一个常见错误是混淆因变量和自变量。你想预测的那个变量必须是 y。此外,解释斜率时要加上单位,避免使用“x 导致 y”这样的武断表述。使用诸如“平均而言,x 每增加一个单位,y 随之增加 b 个单位”之类的说法。
Time management is key. Practice extracting summary statistics quickly from a table or list. When a question says “find the equation of the regression line”, it expects you to calculate both a and b, and write the full equation. Drawing a scatterplot and a residual plot mentally helps you check whether the linear model is sensible.
时间管理至关重要。练习从表格或列表中快速提取总结统计量。当题目要求“求回归直线方程”时,既需计算 a 也需计算 b,并写出完整方程。在脑海中画出散点图和残差图有助于判断线性模型是否合理。
Published by TutorHao | Mathematics Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

或截图后用「扫一扫 → 相册」选择本图