Я пытаюсь использовать Apache Commons Math's SpearmansCorrelation, но у меня есть некоторые трудности, поскольку у меня недостаточно фона в математике/статистике.Apache Commons Math SpearmansCorrelation - Как использовать
Я исследовал ранговой корреляции Спирмена от:
- https://statistics.laerd.com/statistical-guides/spearmans-rank-order-correlation-statistical-guide-2.php
- http://geographyfieldwork.com/SpearmansRank.htm
я нашел следующие примеры:
- http://www.devdaily.com/java/jwarehouse/commons-math/src/main/java/org/apache/commons/math/stat/correlation/SpearmansCorrelation.java.shtml
- http://www.devdaily.com/java/jwarehouse/commons-math/src/test/java/org/apache/commons/math/stat/correlation/SpearmansRankCorrelationTest.java.shtml
- http://www.androidadb.com/class/na/NaturalRanking.html
Я хотел бы, чтобы вычислить корреляцию между двумя списками моего класса:
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?