首页 > 代码库 > 相关度等概念计算总结

相关度等概念计算总结

假设X和Y均为含有n项的向量,

X = Vector(n)Y = Vector(n)

则相关度计算如下

Rou(x, y) = Cov(X, Y)/sqrt(D(X)*D(Y))                                                            (1)      = (E(XY)-E(X)E(Y))/sqrt((E(X^2)-(E(X)^2))*(E(Y^2)-(E(X)^2)))                                           (2)      = (Sigma(XY)/n - Sigma(X)*Sigma(Y)/n^2)/sqrt((Sigma(X^2)/n - (Sigma(X)/n)^2)*(Sigma(Y^2)/n - (Sigma(Y)/n)^2))    // *n      = (Sigma(XY) - Sigma(X)*Sigma(Y)/n)        /         sqrt((Sigma(X^2) - Sigma(X)^2/n) * (Sigma(Y^2) - (Sigma(Y)^2/n)))

(1)和(2)的推断可以参考概率论和数理统计相关的书。

相关度等概念计算总结