(defn spearmans-rho
"
http://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient
In statistics, Spearman's rank correlation coefficient or Spearman's rho, is a non-parametric measure of correlation – that is, it assesses how well an arbitrary monotonic function could describe the relationship between two variables, without making any other assumptions about the particular nature of the relationship between the variables. Certain other measures of correlation are parametric in the sense of being based on possible relationships of a parameterised form, such as a linear relationship.
"
[a b]
(let [_ (assert (= (count a) (count b)))
n (count a)
arank (rank-index a)
brank (rank-index b)
dsos (apply
+ (map (fn [x y] (pow
(- (arank x) (brank y))
2))
a b))]
(- 1 (/ (* 6 dsos)
(* n (- (pow n 2) 1))))))
Vars in
incanter.stats/spearmans-rho:
*
-
/
defn
let
Used in 0 other vars
Comments top
No comments for spearmans-rho. Log in to add a comment.