(defn correlation
"
Returns the sample correlation of x and y, or the correlation
matrix of the given matrix.
Examples:
References:
http://incanter.org/docs/parallelcolt/api/cern/jet/stat/tdouble/DoubleDescriptive.html
http://en.wikipedia.org/wiki/Correlation
"
([x y]
(let [
xx (to-list x)
yy (to-list y)
]
(DoubleDescriptive/correlation
(DoubleArrayList. (double-array xx)) (sd x)
(DoubleArrayList. (double-array yy)) (sd y))))
([mat]
(div (covariance mat)
(sqrt (mmult (diag (covariance mat)) (trans (diag (covariance mat))))))))
Used in 0 other vars
Comments top
No comments for correlation. Log in to add a comment.