等级相关系数 Coefficient Of Rank Correlation

2014-12-03 0 711
等级相关系数 Coefficient Of Rank Correlation
puts "Enter Number of Data Set"
n=gets.chomp
n=n.to_f
sum_d=0
i=0
while i<n
 i=i+1
 puts "For Set "+i.to_s
 puts "Rank of Group 1"
 r1=gets.chomp
 r1=r1.to_f
 puts "Rank of Group 2"
 r2=gets.chomp
 r2=r2.to_f
 diff=r1-r2
 d=diff**2
 sum_d=sum_d+d
end

r=1-(6*sum_d)/(n*(n**2-1))
puts "Coefficient of Rank Correlation "+r.to_s

遇见资源网 ruby 等级相关系数 Coefficient Of Rank Correlation http://www.ox520.com/16190.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务