2012-04-11 6 views
1

Ich versuche Apache Commons Math's SpearmansCorrelation zu verwenden, aber ich habe einige Schwierigkeiten, wie ich nicht genug Hintergrund in Mathematik/Statistik habe.Apache Commons Math SpearmansCorrelation - Wie zu verwenden

Ich habe Spearman Rank Correlation recherchiert von:

ich die folgenden Beispiele gefunden haben:

würde Ich mag die Korrelation zwischen zwei Listen meiner Klasse berechnen:

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

aus dem ich abgeleitet habe folgendes:

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? 

Antwort

2

Für die Beispiel gefunden in the link you provided, alles, was Sie tun müssen, ist:

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

Die Klasse wird standardmäßig Verbindungen durchschneiden.

Verwandte Themen