R² 决定系数 R² 计算器(数据拟合或 SS)Coefficient of Determination (R²) Calculator (from Data or SS)
两种方式:输入成对的 x、y 数据,求最小二乘直线 y = a + bx、相关系数 r、R² 和调整 R²;或直接由残差平方和 SS_res 与总平方和 SS_tot 求 R²。本地处理。Two ways: enter paired x and y data to get the least-squares line y = a + bx, the correlation r, R² and adjusted R², or get R² straight from the residual and total sums of squares. Processed locally.
使用说明与常见问题How-to & FAQ
「决定系数 R² 计算器(数据拟合或 SS)」是什么?What is the Coefficient of Determination (R²) Calculator (from Data or SS) tool?
两种方式:输入成对的 x、y 数据,求最小二乘直线 y = a + bx、相关系数 r、R² 和调整 R²;或直接由残差平方和 SS_res 与总平方和 SS_tot 求 R²。本地处理。Two ways: enter paired x and y data to get the least-squares line y = a + bx, the correlation r, R² and adjusted R², or get R² straight from the residual and total sums of squares. Processed locally.
如何使用「决定系数 R² 计算器(数据拟合或 SS)」?How do I use the Coefficient of Determination (R²) Calculator (from Data or SS) tool?
在「决定系数 R² 计算器(数据拟合或 SS)」中,填写「方式」、「x 值」、「y 值(或实际值)」、「预测值」、「SS_res」等参数,结果会随输入实时计算并显示在下方。In the Coefficient of Determination (R²) Calculator (from Data or SS): Fill in "Method", "x values", "y values (or actual)", "Predicted values", "SS_res"; results are recalculated instantly as you type.
R² 怎么算?How is R² calculated?
R² = 1 − SS_res ÷ SS_tot。SS_res 是实际值与拟合值之差的平方和,SS_tot 是实际值与平均值之差的平方和。简单线性回归中 R² 等于相关系数 r 的平方。R² = 1 − SS_res / SS_tot, where SS_res is the sum of squared differences between actual and fitted values and SS_tot the sum of squared differences from the mean. In simple linear regression R² equals r squared.
调整 R² 是什么?What is adjusted R²?
调整 R² = 1 − (1 − R²)(n − 1)/(n − p − 1),这里 p = 1 个自变量。它会惩罚过多的自变量,样本少时比 R² 更保守。Adjusted R² = 1 − (1 − R²)(n − 1)/(n − p − 1), with p = 1 predictor here. It penalises extra predictors and is more cautious than R² for small samples.
R² 可以为负吗?Can R² be negative?
用“实际值与预测值”或 SS 方式时可以:说明预测比直接用平均值还差。对数据做最小二乘直线拟合时 R² 在 0 到 1 之间。Yes, with actual-vs-predicted values or SS figures: the predictions are worse than the mean. For a least-squares line fitted to the data R² is between 0 and 1.
能举个计算实例吗?Can you show a worked example?
例如在「决定系数 R² 计算器(数据拟合或 SS)」中填 方式 = 由数据拟合直线,x 值 = 1, 2, 3, 4, 5,y 值(或实际值) = 2, 4, 5, 4, 5,结果区显示:拟合直线:y = 2.2 + 0.6x;R²:0.6;相关系数 r:0.774597;调整 R²:0.466667;SS_res / SS_tot:2.4 / 6;n:5;ℹ R² 表示 y 的波动中有多少能被直线解释,不代表因果关系。For example, entering Method = Fit a line to data, x values = 1, 2, 3, 4, 5, y values (or actual) = 2, 4, 5, 4, 5 in the Coefficient of Determination (R²) Calculator (from Data or SS) gives: Fitted line: y = 2.2 + 0.6x; R²: 0.6; Correlation r: 0.774597; Adjusted R²: 0.466667; SS_res / SS_tot: 2.4 / 6; n: 5; ℹ R² is the share of the variation in y explained by the line; it does not show cause and effect.
哪些输入会被检查?Which inputs are validated?
「决定系数 R² 计算器(数据拟合或 SS)」会检查这些输入——「SS_res」:所选方式用到时必须填写;「SS_tot」:所选方式用到时必须填写,须大于 0;绝对值超过 10¹⁵ 的数也会被拒绝。不符合时结果区显示具体提示,不会给出数字。The Coefficient of Determination (R²) Calculator (from Data or SS) checks its inputs — "SS_res": required when the chosen option uses it; "SS_tot": required when the chosen option uses it, must be greater than 0; numbers above 10¹⁵ in absolute value are rejected too. When a value fails, the result area names the problem instead of showing a number.
有哪些选项可以调整?What options can I adjust?
「决定系数 R² 计算器(数据拟合或 SS)」的设置:「方式」可选 由数据拟合直线、由 SS_res 和 SS_tot、实际值与预测值(默认 由数据拟合直线);「x 值」默认 1, 2, 3, 4, 5;「y 值(或实际值)」默认 2, 4, 5, 4, 5;「预测值」默认 2.8, 3.4, 4, 4.6, 5.2;「SS_res」默认 20;「SS_tot」默认 100。每次生成结果都按当前设置处理。Settings in the Coefficient of Determination (R²) Calculator (from Data or SS) — "Method": Fit a line to data, From SS_res and SS_tot, Actual vs predicted (default Fit a line to data); "x values" default 1, 2, 3, 4, 5; "y values (or actual)" default 2, 4, 5, 4, 5; "Predicted values" default 2.8, 3.4, 4, 4.6, 5.2; "SS_res" default 20; "SS_tot" default 100. The result always uses the current settings.
计算精度如何?How precise are the results?
「决定系数 R² 计算器(数据拟合或 SS)」使用 JavaScript 双精度浮点数(约 15–16 位有效数字);极大或极小的数值可能存在精度误差。The Coefficient of Determination (R²) Calculator (from Data or SS) uses double-precision floating point (about 15–16 significant digits); very large or very small values may lose precision.
「决定系数 R² 计算器(数据拟合或 SS)」免费吗?需要注册吗?Is the Coefficient of Determination (R²) Calculator (from Data or SS) free? Do I need an account?
「决定系数 R² 计算器(数据拟合或 SS)」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Coefficient of Determination (R²) Calculator (from Data or SS) is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.