chzzz's Blog

The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge.--Stephen William Hawking

皮尔逊系数与斯皮尔曼系数(The Pearson Correlation and The Spearman Correlation )

  1. The Pearson Correlation: from -1 to 1 measuring the linear relationship between two variables

  2. The Spearman Correlation: from -1 to 1 measuring the monotonic relationship between two variables

The Spearman correlation is 1 if as one variable increases, the other does as well, even if the relationship is not linear. On the other hand, the Pearson correlation can only be one if the increase is exactly linear. These are best illustrated by example.


python中两种相关系数的代码

from scipy.stats import spearmanr
import numpy as np
spr = spearmanr(x, y).correlation
pcr = np.corrcoef(x, y)[0, 1]

皮尔逊系数与斯皮尔曼系数(The Pearson Correlation and The Spearman Correlation )

皮尔逊系数与斯皮尔曼系数(The Pearson Correlation and The Spearman Correlation )

发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

© 版权所有:沈阳市和平区赛博空间咨询部|辽ICP备18005891号
Powered by Z-BlogPHP & Yiwuku.com