word x y is 5/113 23/234 the 4/113 45/234 a 4/113 17/234 farnarkling 1/113 0/234 elbow 0/113 2/234 ... =============================== TOTAL 113/113 234/234
然后你会计算:
word x y u=x*y v=x*x is 5/113 23/234 115/26442 25/12769 the 4/113 45/234 180/26442 16/12769 a 4/113 17/234 68/26442 16/12769 farnarkling 1/113 0/234 0/26442 1/12769 elbow 0/113 2/234 0/26442 0/12769 ... ======================================================== TOTAL 113/113 234/234 s=(sum of u) t=(sum of v)
1 回答
在排名方面,在您的应用程序中,您不需要缺少值 . 当一个单词在一个文件中出现但在另一个文件中没有出现时,您可以在另一个文件中给出它最后的排名(或者等于多个缺失值的最后排名) .
但是,我不确定对许多缺失值的Spearman值的影响(很多并列的最后排名) . 您可以考虑在原始相对频率上使用标准相关/回归,而不是使用Spearman系数 .
例...
假设文件x具有m = 113个字,而文件y具有n = 234 . 我们可以创建一个相对字频率表,如下所示:
word x y is 5/113 23/234 the 4/113 45/234 a 4/113 17/234 farnarkling 1/113 0/234 elbow 0/113 2/234 ... =============================== TOTAL 113/113 234/234
然后你会计算:
word x y u=x*y v=x*x is 5/113 23/234 115/26442 25/12769 the 4/113 45/234 180/26442 16/12769 a 4/113 17/234 68/26442 16/12769 farnarkling 1/113 0/234 0/26442 1/12769 elbow 0/113 2/234 0/26442 0/12769 ... ======================================================== TOTAL 113/113 234/234 s=(sum of u) t=(sum of v)
你的答案是由s / t给出的 . 接近m / n的值意味着良好的对应关系 .
一些可能有用的链接是:
https://statistics.laerd.com/statistical-guides/spearmans-rank-order-correlation-statistical-guide.php
http://en.wikipedia.org/wiki/Simple_linear_regression