Pearson Correlation Coefficient
Pearson 相关系数, 计算X和Y之间的线性相关程度,范围[-1, +1]。+1表示正线性相关,0表示线性无关,-1表示负线性相关。
公式:
![](http://www.forkosh.com/mathtex.cgi? \rho_{X, Y} = \frac{Cov(X, Y)}{\sigma_X \sigma_Y})
其中,![](http://www.forkosh.com/mathtex.cgi? Cov(X, Y) = E[(X-\mu_X)(Y-\mu_Y)])
![](http://www.forkosh.com/mathtex.cgi? \mu_X = E[X])
![](http://www.forkosh.com/mathtex.cgi? \mu_Y = E[Y])
![](http://www.forkosh.com/mathtex.cgi? \sigma_X^2 = E[(X-E[Y])^2] = E[X^2] - (E[X])^2)
![](http://www.forkosh.com/mathtex.cgi? \sigma_Y^2 = E[(Y-E[Y])^2] = E[Y^2] - (E[Y])^2)
![](http://www.forkosh.com/mathtex.cgi? Cov(X, Y) = E[(X-\mu_X)(Y-\mu_Y)] = E[XY]-E[X]E[Y])
![](http://www.forkosh.com/mathtex.cgi? Cov(X, Y) = \frac{\sum_{i=1}^n{(X_i - \bar X)(Y_i - \bar Y)}}{n-1})
Cov: 协方差
σ: 标准差
Sample PCC
![](http://www.forkosh.com/mathtex.cgi? r = \frac{\sum_{i=1}^n{(x_i - \bar y)(y_i - \bar y)}}{\sqrt{\sum_{i=1}^n{(x_i - \bar x)2}}\sqrt{\sum_{i=1}n{(y_i - \bar y)^2}}})