From b31ace79ea5f6b3f279c544cd3a443d6fbf2a24d Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Thu, 26 Feb 2026 10:05:59 +0000 Subject: overhaul --- kendalls-tau | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'kendalls-tau') diff --git a/kendalls-tau b/kendalls-tau index c0c20be..24f0744 100755 --- a/kendalls-tau +++ b/kendalls-tau @@ -2,7 +2,7 @@ ################################################# # reads space delimted pairs of scores as input, -# outputs Kendall's τ +# outputs Kendall"s τ ################################################# def kendall_with_ties l @@ -13,7 +13,7 @@ def kendall_with_ties l l.each_with_index { |k,i| l[i+1,l.size].each_with_index { |m,j| if (k.first < m.first && k[1] < m[1]) || - (k.first > m.first && k[1] > m[1]) + (k.first > m.first && k[1] > m[1]) concordant += 1 elsif (k.first == m.first && k[1] != m[1]) tie_a += 1 @@ -24,7 +24,7 @@ def kendall_with_ties l end } } - + return (concordant-disconcordant)/(Math.sqrt((concordant+disconcordant+tie_a)*(concordant+disconcordant+tie_b))) end @@ -34,7 +34,7 @@ def kendall l l.each_with_index { |k,i| l[i+1,l.size].each_with_index { |m,j| if (k.first <= m.first && k[1] <= m[1]) || - (k.first >= m.first && k[1] >= m[1]) + (k.first >= m.first && k[1] >= m[1]) concordant += 1 else disconcordant += 1 @@ -60,7 +60,7 @@ def main a,b = line.split l << [a.to_f, b.to_f] end - + v = -1 if has_ties? l v = kendall_with_ties l @@ -72,4 +72,3 @@ def main end main - -- cgit v1.2.3