📚 Selecting a Model | 选择模型
In A-Level Mathematics, you often need to find a mathematical function that describes the relationship between two variables from a given data set. The process of choosing the best function—a linear, quadratic, exponential, or other form—is called model selection. A good model not only fits the observed data closely but also captures the underlying pattern without being overly complex. This article explains the key ideas and methods used to select an appropriate model, with a focus on the Edexcel specification.
在 A-Level 数学中,你经常需要根据给定的数据找到描述两个变量关系的数学函数。选择最佳函数(线性、二次、指数或其他形式)的过程称为模型选择。一个好的模型不仅要与观测数据高度吻合,还要能捕捉潜在的模式,而不过于复杂。本文以 Edexcel 考试大纲为基础,讲解用于选择合适模型的关键思想与方法。
1. Introduction to Model Selection | 模型选择简介
When presented with bivariate data, our goal is to identify a formula that can be used to predict values of the dependent variable (y) from the independent variable (x). However, no single model is universally best; the choice depends on the shape of the data, statistical measures, and the context. Model selection involves comparing different candidate functions and evaluating how well each one represents the data. At A-Level, common candidates include linear, quadratic, exponential, and power models, although others may appear.
当面对双变量数据时,我们的目标是找出一个可以用自变量 x 预测因变量 y 的公式。然而,没有哪个模型是普遍最好的;选择取决于数据的形态、统计量以及问题背景。模型选择包括比较不同的候选函数,并评估每个函数对数据的代表性。在 A-Level 阶段,常见的候选模型有线性、二次、指数和幂函数模型,也可能出现其他类型。
We assess models using both graphical and numerical tools. A scatterplot gives a first impression of the relationship. From there, we can fit a regression line or curve, then examine the residuals (the differences between observed and predicted values) and calculate summary statistics like the correlation coefficient and coefficient of determination. These tools, together with an understanding of the model's limitations, guide us toward the most suitable choice.
我们使用图形和数值工具来评估模型。散点图提供了关系的初步印象。然后我们可以拟合回归直线或曲线,接着检查残差(观测值与预测值之差),并计算相关系数、决定系数等汇总统计量。这些工具,加上对模型局限性的理解,会引导我们做出最合适的选择。
2. Types of Mathematical Models | 数学模型的类型
ssumes that y changes at a constant rate as x increases. It is appropriate when the scatterplot shows points roughly along a straight line. The parameters a (intercept) and b (slope) are estimated by the least squares method. Despite its simplicity, the linear model is very powerful and forms the foundation for many other techniques.
最简单且最常用的模型是线性模型:y = a + bx。它假定 y 随 x 以恒定速率变化。当散点图中的点大致沿一条直线分布时,线性模型是合适的。参数 a(截距)和 b(斜率)通过最小二乘法进行估计。尽管简单,线性模型却非常强大,并且是许多其他技术的基础。
ximum or minimum). Higher-degree polynomials can be used, but they risk overfitting. Another common form is the exponential model, y = a ebx is useful when growth or decay is proportional to the current value. Power models, y = a xb o considered, and they become linear under a log-log transformation: ln y = ln a + b ln x.
当数据呈现弯曲模式时,我们可以考虑二次模型:y = a + bx + cx²。这是二次多项式,可以表示一个弯曲(最大值或最小值)。更高次的多项式也可使用,但有过度拟合的风险。另一种常见形式是指数模型:y = a ebx,或等价地 ln y = ln a + bx,适用于增长或衰减速率与当前值成比例的情况。幂模型 y = a xb 也会被考虑,它在双对数变换下变为线性:ln y = ln a + b ln x。
3. Scatterplots and Initial Assessment | 散点图与初步评估
The first step in model selection is always to produce a scatterplot of the data. Plotting y against x reveals the overall trend, any outliers, and whether the relationship appears linear or non-linear. A strong linear pattern suggests starting with a linear regression. A curved pattern with one turning point hints at a quadratic. If the data show a rapid increase that slows down, an exponential or square root model might be more appropriate.
模型选择的第一步总是绘制数据的散点图。描绘 y 对 x 的图可以揭示整体趋势、任何异常值,以及关系是线性的还是非线性的。强烈的线性模式意味着可以从线性回归开始。具有一个转折点的弯曲模式暗示二次模型。如果数据显示出先快速上升然后减慢的趋势,指数或平方根模型可能更合适。
It is important to look for signs of clustering, heteroscedasticity (changing spread), or outliers. Such features may indicate that a simple model will not fit well, or that a transformation of variables is needed. The scatterplot alone, however, is not enough for a final decision; numerical measures must back up visual impressions.
观察数据是否有聚集、异方差性(散度变化)或异常值的迹象十分重要。这些特征可能表明简单模型拟合效果不佳,或者需要对变量进行变换。然而,仅凭散点图不足以作出最终决定;还需要数值指标来支撑视觉印象。
4. Correlation Coefficient r | 相关系数 r
For a linear model, the product-moment correlation coefficient (often just called r) measures the strength and direction of a linear relationship between x and y. It is given by:
对于线性模型,积矩相关系数(通常简称为 r)衡量 x 和 y 之间线性关系的强度和方向。其计算公式为:
r = Σ[(xᵢ - x̄)(yᵢ - ȳ)] / √[ Σ(xᵢ - x̄)² Σ(yᵢ - ȳ)² ]
The value of r lies between –1 and 1. An r close to 1 indicates a strong positive linear correlation; an r close to –1 indicates a strong negative linear correlation. A value near 0 suggests no linear relationship. However, r only measures linear association. A low r does not necessarily mean there is no relationship; the relationship could be strong but non-linear (e.g., quadratic).
r 的取值范围在 –1 到 1 之间。r 接近 1 表示强正线性相关;接近 –1 表示强负线性相关。接近 0 则表明没有线性关系。但 r 只测量线性关联程度,低 r 值并不一定意味着没有关系;关系可能很强但是非线性的(例如二次关系)。
In model selection, a significantly high absolute value of r supports the choice of a linear model. Still, one should check if a non-linear model might give an even better fit, especially if the scatterplot shows curvature. Moreover, correlation does not imply causation—an important reminder when interpreting models in real-world contexts.
在模型选择中,若 |r| 显著较高,则支持选用线性模型。但还应检查非线性模型是否能提供更好的拟合,尤其当散点图显示弯曲时。此外,相关关系并不意味着因果关系——这是在现实情境中解释模型时的重要提醒。
5. Coefficient of Determination (R²) | 决定系数 R²
The coefficient of determination, denoted R², is a broader measure of how well a regression model fits the data. For any model (linear or non-linear), it is defined as:
决定系数,记作 R²,是衡量回归模型拟合数据好坏的一个更广泛的指标。对于任何模型(线性或非线性),其定义为:
R² = 1 – (SS_res / SS_tot)
where SS_res = Σ (yᵢ – ŷᵢ)² is the residual sum of squares, and SS_tot = Σ (yᵢ – ȳ n of the variance in y that is explained by the model. An R² of 0.8, for example, means 80% of the variation in y is accounted for by the independent variable(s).
其中 SS_res = Σ (yᵢ – ŷᵢ)² 是残差平方和,SS_tot = Σ (yᵢ – ȳ)² 是总平方和。R² 表示模型解释的 y 的方差比例。例如,R² = 0.8 表示 y 中 80% 的变异可由自变量解释。
When comparing models, a higher R² generally indicates a better fit. However, adding more parameters always increases R², even if the new terms are not meaningful. Therefore, we use adjusted R² (not always required at A-Level but useful conceptually) or simply balance R² with model simplicity. A quadratic model might have a slightly higher R² than a linear model, but if the increase is very small, the linear model may be preferred for its parsimony.
在比较模型时,R² 越高通常表示拟合越好。但增加更多参数总会使 R² 增大,即使新增项并无实际意义。因此,我们会使用调整后的 R²(A-Level 不要求,但概念上有用)或者简单地在 R² 和模型简洁性间权衡。二次模型的 R² 可能略高于线性模型,但如果增幅很小,为了简约性,线性模型可能更合适。
6. Residuals and Residual Plots | 残差与残差图
rved values and those predicted by the model. For each data point, the residual is eᵢ = yᵢ – ŷ ly scattered around zero, with no apparent pattern. Systematic patterns in a residual plot—such as a curve or a fan shape— of the data’s structure and that a different model (or a transformation) might be needed.
残差是观测值与模型预测值之间的误差。对于每个数据点,残差为 eᵢ = yᵢ – ŷᵢ。一个拟合良好的模型,其残差应当随机散布在零附近,没有明显模式。残差图中若出现系统性的模式——如弯曲或扇形——则表明模型未能捕捉到数据结构的某些方面,可能需要更换模型(或进行变换)。
To construct a residual plot, plot the residuals e against the predicted values ŷ or against the independent variable x. For a linear model that fits well, the points should form a horizontal band of constant width. If the spread of residuals widens as ŷ increases, the assumption of constant variance (homoscedasticity) is violated, which might suggest a transformation like taking logarithms of y.
绘制残差图时,用残差 e 对预测值 ŷ 或自变量 x 作图。对于拟合良好的线性模型,各点应形成宽度恒定的水平带状。如果残差的分散程度随 ŷ 增大而变宽,则等方差假设(同方差性)被破坏,这可能提示需要对 y 进行对数等变换。
7. Goodness of Fit Measures | 拟合优度指标
Beyond R² and residual analysis, other numerical measures help in model selection. The root mean squared error (RMSE) is computed as √ SS_res / n and has the same units as y; a smaller RMSE indicates better predictive accuracy. The mean absolute error (MAE) is another alternative that is less sensitive to outliers. Both can be compared across different models, with preference given to the model that yields the smallest error.
除了 R² 和残差分析,还有其他数值指标有助于模型选择。均方根误差 (RMSE) 计算为 √ SS_res / n ,与 y 单位相同;RMSE 越小说明预测精度越高。平均绝对误差 (MAE) 是另一个替代指标,对异常值的敏感性较低。两者都可在不同模型间比较,应优先选用误差最小的模型。
A more formal approach is hypothesis testing on the regression coefficients, though this is often reserved for later study. At A-Level, a practical combination of high R², low RMSE, and randomly scattered residuals provides strong evidence that a model is appropriate. Additionally, the significance of individual terms (e.g., the quadratic coefficient) can be checked using t-tests if required by the syllabus.
更正式的方法是对回归系数进行假设检验,不过这通常留给后续学习。在 A-Level 阶段,高 R²、低 RMSE 和随机散布的残差这一实用组合,能够有力地证明模型的合适性。此外,如果教学大纲要求,也可以用 t 检验检查个别项(如二次项系数)的显著性。
8. Comparison of Models: An Example | 模型比较实例
three models: linear (y = a + bx), quadratic (y = a + bx + cx²), and exponential (y = a ebx lds R² = 0.987 and residuals that appear random and evenly spread. The exponential model, after taking logs, gives a high linear correlation for ln y versus x, but the residual plot of the original scale still displays a slight curve.
考虑一个关于汽车速度(x,英里/小时)与刹车距离(y,英尺)的数据集。散点图显示出弯曲上升的趋势。我们拟合三个模型:线性 (y = a + bx)、二次 (y = a + bx + cx²) 和指数 (y = a ebx)。线性模型得出 r = 0.81,R² = 0.656,残差图呈现明显的 U 形,表明拟合不佳。二次模型的 R² = 0.987,残差随机且均匀分布。指数模型取对数后,ln y 对 x 的线性相关性很高,但原尺度的残差图仍显示轻微弯曲。
Based on R², residual patterns, and RMSE, the quadratic model is the best choice. It explains 98.7% of the variation in stopping distance, and the residuals display no systematic structure. This example illustrates how multiple criteria should be used together to select the most suitable model rather than relying on a single statistic.
根据 R²、残差模式和 RMSE,二次模型是最佳选择。它解释了刹车距离 98.7% 的变异,且残差没有系统性结构。这个例子说明,应当综合使用多条标准来选择最合适的模型,而不能依赖单一的统计量。
9. Considering Transformations | 考虑变量变换
applied after transforming one or both variables. For an exponential relationship y = a ebx oximately linear, an exponential model is appropriate. Similarly, a power function y = a xb = ln a + b ln x, so a plot of ln y against ln x should be linear if the power model holds.
有时对其中一个或两个变量进行变换后,就可以使用简单的线性模型。对于指数关系 y = a ebx,取自然对数得到 ln y = ln a + bx,这是 ln y 关于 x 的线性关系。如果 ln y 对 x 的散点图近似直线,则指数模型合适。类似地,幂函数 y = a xb 变为 ln y = ln a + b ln x,因此若幂模型成立,ln y 对 ln x 的图应为直线。
When using transformations, one must be cautious about the interpretation of R² and residuals. The fit is optimized on the transformed scale, but back-transforming predictions can introduce bias. Nevertheless, transformation is a powerful technique that extends the reach of linear regression to many non-linear situations commonly encountered in A-Level problems.
使用变换时,必须谨慎解释 R² 和残差。拟合是在变换后的尺度上进行优化的,但将预测值反变换回原尺度可能引入偏差。尽管如此,变换是一种强大的技术,它将线性回归的适用范围扩展到 A-Level 常见问题中的许多非线性情形。
10. Overfitting and Parsimony | 过拟合与简约性原则
er, such a model would capture not only the underlying relationship but also random noise, leading to poor predictions for new data. This is called overfitting. The principle of parsimony (Occam’s razor) states that among models that fit similarly well, the simplest one should be chosen.
对于多项式模型,我们可以提高次数,使曲线精确通过所有数据点,得到 R² = 1 和零残差。然而,这样的模型不仅捕捉了潜在关系,还捕捉了随机噪声,导致对新数据的预测效果很差,这称为过拟合。简约性原则(奥卡姆剃刀)指出,在拟合效果近似的模型中,应当选择最简单的那个。
At A-Level, you will mostly compare a straight line with a quadratic, or perhaps a cubic, and judge whether the extra complexity is justified by a substantial improvement in fit and by the appearance of the residual plot. Avoid choosing a high-degree polynomial simply because it has a slightly higher R².
在 A-Level 阶段,你主要会比较直线与二次曲线,或许还有三次曲线,并判断额外的复杂性是否因拟合效果显著改善以及残差图的外观而合理。应避免仅仅因为高次多项式 R² 略高就选择它。
11. Extrapolation and Model Validity | 外推与模型有效性
Every model is valid only within the range of the observed data—or possibly slightly beyond, with caution. Predicting y for x-values far outside the original data range is called extrapolation, and it can lead to highly unreliable results. For instance, a quadratic model for stopping distance that fits well for speeds between 10 and 70 mph might give absurd predictions at 200 mph, perhaps even negative distances if the quadratic turns downward. Always state the limitations of your chosen model regarding the domain of x.
任何模型仅在其观测数据范围内有效——或可能谨慎地稍作外延。基于远离原始数据范围的 x 值预测 y 称为外推,这可能导致极不可靠的结果。例如,一个在 10 到 70 mph 速度范围内拟合良好的刹车距离二次模型,可能在 200 mph 时给出荒谬的预测值,若二次曲线向下弯曲,甚至可能出现负距离。在论述所选模型时,务必说明关于 x 取值范围的限制。
In exam questions, you may be asked to comment on why a model is unsuitable for prediction beyond the data range. Good practice is to refer to the residual plot, the physical context, and the mathematical behaviour of the function (e.g., a parabola eventually decreasing while distance cannot decrease).
考试题中可能会要求你评论为什么某模型不适合超出数据范围的预测。好的做法是结合残差图、实际背景以及函数的数学行为(例如抛物线最终会下降,而距离不可能下降)来说明。
12. Summary and Exam Tips | 总结与考试提示
Selecting a model effectively requires a combination of graphical judgement and numerical evidence. Start with a scatterplot, decide on candidate models, fit them, and then examine r, R², RMSE, and most importantly, the residual plots. Always aim for a simple model that captures the main trend without overfitting. When transformations are used, check the linearity on the transformed scale. Finally, be explicit about the domain of validity and avoid extravagant extrapolation.
高效地选择模型需要将图形判断与数值证据相结合。从散点图入手,确定候选模型,进行拟合,然后检查 r、R²、RMSE,最重要的是残差图。始终力求选择一个能捕捉主要趋势而又不过度拟合的简洁模型。当使用变换时,要检验变换后尺度的线性性。最后,要明确说明有效范围,避免过度外推。
In Edexcel A-Level exams, typical questions provide a data set and ask you to select between two given models, or to justify a choice using statistical measures. Practice interpreting R² and residuals in context, and be prepared to explain why a model is or is not appropriate. Remember that a good answer blends numerical results with real-world reasoning.
在 Edexcel A-Level 考试中,典型题目会提供一组数据,要求你在两个给定模型之间进行选择,或者根据统计量解释你的选择理由。要练习结合情境解释 R² 和残差,并准备好说明为什么某个模型合适或不合用。记住,优秀的答案会将数值结果与现实推理融为一体。
Published by TutorHao | Mathematics Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

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