【问题标题】:Apache Commons Math SpearmansCorrelation - How to useApache Commons Math SpearmansCorrelation - 如何使用
【发布时间】:2012-04-23 17:34:23
【问题描述】:

我正在尝试使用Apache Commons Math's SpearmansCorrelation,但我遇到了一些困难,因为我没有足够的数学/统计学背景。

我从以下方面研究了 Spearman 的等级相关性:

我找到了以下例子:

我想计算我班级的两个列表之间的相关性:

public class TestClass{
    int rank; // there may be two or more classes with the same rank - will need an averaging ties strategy
}

从中我得出以下结论:

NaturalRanking naturalRanking = new NaturalRanking(NaNStrategy.FIXED,
        TiesStrategy.AVERAGE);

RealMatrix dataMatrix= createRealMatrix(double[], int, int); // what do I need this matrix for and what parameters do I need to pass?

SpearmansCorrelation sc = SpearmansCorrelation(dataMatrix, naturalRanking);
sc.correlation(double[],double[]);// I have to convert my class into a list of doubles? How? 

【问题讨论】:

    标签: java apache statistics apache-commons


    【解决方案1】:

    对于the link you provided 中的示例,您只需:

    new SpearmansCorrelation().correlation(mathsList,englishList);
    

    默认情况下,该课程将平均平局。

    【讨论】:

      猜你喜欢
      • 2015-01-21
      • 1970-01-01
      • 2014-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-24
      • 2012-07-05
      相关资源
      最近更新 更多