节能计算器
计算皮尔逊的 r 在两个数字列表之间。
输入结果时更新 。
关于此计算器
Pearson’s correlation coefficient (r) measures the strength and direction of the linear relationship between two variables, ranging from −1 (perfect negative) through 0 (no linear relationship) to +1 (perfect positive). It is found by dividing the covariance of x and y by the product of their standard deviations, which standardises the result into that fixed −1 to +1 range.
Enter paired x and y values in the same order; the two lists must have the same number of values. The calculator returns r, the coefficient of determination r², the covariance, and the least-squares regression line (slope and intercept), plus a plain-English reading of the strength, and plots the data with its best-fit line. It needs at least two pairs, and the result is undefined if either variable never changes.
Worked example: for x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 6 the points trend upward together, giving r ≈ 0.85 — a strong positive correlation — and r² ≈ 0.73, meaning about 73% of the variation in y is explained by a straight-line relationship with x. Correlation is used in finance, science and social research to spot which variables move together.
经常问到的问题
相关系数告诉我什么?
它量化两个变量在直线中相近的密切移动。 接近+1 或-1 的值表示强烈的线性关系, 而接近0 的值表示小于或没有线性关联。 该符号显示关系的方向 。
关联是否意味着因果关系?
否。 高度相关性显示两个变量同时移动,但一个变量不会导致另一个变量。 隐藏的第三个因素,或纯粹的巧合,可以产生一个没有因果关系的强烈关联。
R2是什么?
R2是相关系数的正方形。它是y的变异比例,其解释是与x的线性关系——0.8r表示R2为0.64,这意味着64%的变化被计算在内。
什么是强烈的关联?
作为粗略的指南,0.3以下绝对r的强度较弱,约0.3至0.5中度,0.5至0.7中度至强者,0.7强者。 这个计算器标出你的力量,但明智的截断因字段而异。
消极关联意味着什么?
负 r 表示变量向相反方向移动: 当一个向上, 另一个向下。 -0.9 的 r 表示线性关系与 +0. 9 一样强烈, 仅向反转。
相互关系和共差之间有什么区别?
共变度衡量两个变量的组合,但其大小取决于它们的单位,因此很难解释。 皮尔逊的 r 是两种标准差的共变差,它们将其调整为无单位值的-1至+1范围。
回归线与相关性有何关联?
最小平方回归线是最适合点的直线, 其斜坡与 r 共享标志。 相关点可以说明点与线的紧紧程度, 而 r 2 给出了线的变异比例 。
API - 使用代码中的计算器
将此计算器称为自由 JSON 端点 。 不需要按键 。 将字段值发送到下面作为查询参数或 JSON 。 任何您省略的, 都会使用相同的默认值, 此页面预填的默认值是预填的; 未知参数是 400, 而不是静音零 。 读取 API 全部文件 →
终点
GET https://calculator.free/api/v1/correlation-coefficient/
curl
curl "https://calculator.free/api/v1/correlation-coefficient/?x=1, 2, 3, 4, 5&y=2, 4, 5, 4, 6"
JavaScript fetch()
const r = await fetch(
"https://calculator.free/api/v1/correlation-coefficient/?" + new URLSearchParams({
"x": "1, 2, 3, 4, 5",
"y": "2, 4, 5, 4, 6"
}));
const data = await r.json();
console.log(data.results);
成果仅是一般指导的估计数,而不是财务、医疗或税务咨询。