1.2.3-SNAPSHOT permalink Arrow_down_16x16

correlation

incanter.stats

  • (correlation x y)
  • (correlation mat)

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

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/stats.clj:1528 top

(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))))))))
Vars in incanter.stats/correlation: defn double-array let
Used in 0 other vars

Comments top

No comments for correlation. Log in to add a comment.