📊 协方差计算器(样本 / 总体,含相关系数)Covariance Calculator (sample or population, with correlation)
计算两组数据的协方差(样本除以 n−1 或总体除以 n),同时给出均值、标准差和 Pearson 相关系数 r。本地处理。Covariance of two data sets (sample, divided by n−1, or population, divided by n), with the means, standard deviations and the Pearson correlation r. Processed locally.
使用说明与常见问题How-to & FAQ
「协方差计算器(样本 / 总体,含相关系数)」是什么?What is the Covariance Calculator (sample or population, with correlation) tool?
计算两组数据的协方差(样本除以 n−1 或总体除以 n),同时给出均值、标准差和 Pearson 相关系数 r。本地处理。Covariance of two data sets (sample, divided by n−1, or population, divided by n), with the means, standard deviations and the Pearson correlation r. Processed locally.
如何使用「协方差计算器(样本 / 总体,含相关系数)」?How do I use the Covariance Calculator (sample or population, with correlation) tool?
在「协方差计算器(样本 / 总体,含相关系数)」中,填写「类型」、「X 数据(空格或换行分隔)」、「Y 数据(与 X 一一对应)」等参数,结果会随输入实时计算并显示在下方。In the Covariance Calculator (sample or population, with correlation): Fill in "Type", "X values (spaces or new lines)", "Y values (paired with X)"; results are recalculated instantly as you type.
样本和总体协方差有什么区别?Sample versus population covariance?
样本协方差除以 n − 1,用来由样本估计总体(无偏估计);数据本身就是整个总体时除以 n。两者只差一个系数 (n − 1)/n。Sample covariance divides by n − 1 and estimates the population value from a sample (unbiased); if the data are the whole population, divide by n. They differ only by the factor (n − 1)/n.
公式是什么?What is the formula?
cov(X, Y) = Σ (xᵢ − x̄)(yᵢ − ȳ) ÷ (n − 1)(样本)或 ÷ n(总体);r = cov(X, Y) ÷ (sₓ · s_y)。cov(X, Y) = Σ (xᵢ − x̄)(yᵢ − ȳ) ÷ (n − 1) (sample) or ÷ n (population); r = cov(X, Y) ÷ (sₓ · s_y).
数据怎么输入?How do I enter the data?
X 和 Y 各一行(或每行一个数),用空格、逗号或换行分隔,两组数个数必须相同且按顺序配对。Put X and Y in their own boxes, separated by spaces, commas or new lines; both lists must have the same count and are paired in order.
能举个计算实例吗?Can you show a worked example?
例如在「协方差计算器(样本 / 总体,含相关系数)」中填 类型 = 样本(除以 n−1),X 数据(空格或换行分隔) = 1 2 3,Y 数据(与 X 一一对应) = 2 4 6,结果区显示:样本协方差:2;n(数据对数):3;X 均值:2;Y 均值:4;X 标准差:1;Y 标准差:2;Pearson 相关系数 r:1;ℹ 协方差的单位是 X 单位 × Y 单位,大小取决于数据尺度;r 是去掉尺度的相关程度(−1 到 1),样本和总体公式下 r 相同。For example, entering Type = Sample (divide by n−1), X values (spaces or new lines) = 1 2 3, Y values (paired with X) = 2 4 6 in the Covariance Calculator (sample or population, with correlation) gives: Sample covariance: 2; n (pairs): 3; Mean of X: 2; Mean of Y: 4; SD of X: 1; SD of Y: 2; Pearson correlation r: 1; ℹ Covariance is in X units × Y units, so its size depends on scale; r is the scale-free correlation (−1 to 1) and is the same for the sample and…
有哪些选项可以调整?What options can I adjust?
「协方差计算器(样本 / 总体,含相关系数)」的设置:「类型」可选 样本(除以 n−1)、总体(除以 n)(默认 样本(除以 n−1));「X 数据(空格或换行分隔)」默认 1 2 3 4;「Y 数据(与 X 一一对应)」默认 2 4 6 8。每次生成结果都按当前设置处理。Settings in the Covariance Calculator (sample or population, with correlation) — "Type": Sample (divide by n−1), Population (divide by n) (default Sample (divide by n−1)); "X values (spaces or new lines)" default 1 2 3 4; "Y values (paired with X)" default 2 4 6 8. The result always uses the current settings.
计算精度如何?How precise are the results?
「协方差计算器(样本 / 总体,含相关系数)」使用 JavaScript 双精度浮点数(约 15–16 位有效数字);极大或极小的数值可能存在精度误差。The Covariance Calculator (sample or population, with correlation) uses double-precision floating point (about 15–16 significant digits); very large or very small values may lose precision.
「协方差计算器(样本 / 总体,含相关系数)」免费吗?需要注册吗?Is the Covariance Calculator (sample or population, with correlation) free? Do I need an account?
「协方差计算器(样本 / 总体,含相关系数)」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Covariance Calculator (sample or population, with correlation) is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.