|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math3.stat.correlation.SpearmansCorrelation
public class SpearmansCorrelation
Spearman's rank correlation. This implementation performs a rank
transformation on the input data and then computes PearsonsCorrelation
on the ranked data.
By default, ranks are computed using NaturalRanking
with default
strategies for handling NaNs and ties in the data (NaNs maximal, ties averaged).
The ranking algorithm can be set using a constructor argument.
Constructor Summary | |
---|---|
SpearmansCorrelation()
Create a SpearmansCorrelation without data. |
|
SpearmansCorrelation(RankingAlgorithm rankingAlgorithm)
Create a SpearmansCorrelation with the given ranking algorithm. |
|
SpearmansCorrelation(RealMatrix dataMatrix)
Create a SpearmansCorrelation from the given data matrix. |
|
SpearmansCorrelation(RealMatrix dataMatrix,
RankingAlgorithm rankingAlgorithm)
Create a SpearmansCorrelation with the given input data matrix and ranking algorithm. |
Method Summary | |
---|---|
RealMatrix |
computeCorrelationMatrix(double[][] matrix)
Computes the Spearman's rank correlation matrix for the columns of the input rectangular array. |
RealMatrix |
computeCorrelationMatrix(RealMatrix matrix)
Computes the Spearman's rank correlation matrix for the columns of the input matrix. |
double |
correlation(double[] xArray,
double[] yArray)
Computes the Spearman's rank correlation coefficient between the two arrays. |
RealMatrix |
getCorrelationMatrix()
Calculate the Spearman Rank Correlation Matrix. |
PearsonsCorrelation |
getRankCorrelation()
Returns a PearsonsCorrelation instance constructed from the
ranked input data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SpearmansCorrelation()
public SpearmansCorrelation(RankingAlgorithm rankingAlgorithm)
rankingAlgorithm
- ranking algorithmpublic SpearmansCorrelation(RealMatrix dataMatrix)
dataMatrix
- matrix of data with columns representing
variables to correlatepublic SpearmansCorrelation(RealMatrix dataMatrix, RankingAlgorithm rankingAlgorithm)
dataMatrix
- matrix of data with columns representing
variables to correlaterankingAlgorithm
- ranking algorithmMethod Detail |
---|
public RealMatrix getCorrelationMatrix()
public PearsonsCorrelation getRankCorrelation()
PearsonsCorrelation
instance constructed from the
ranked input data. That is,
new SpearmansCorrelation(matrix).getRankCorrelation()
is equivalent to
new PearsonsCorrelation(rankTransform(matrix))
where
rankTransform(matrix)
is the result of applying the
configured RankingAlgorithm
to each of the columns of
matrix.
public RealMatrix computeCorrelationMatrix(RealMatrix matrix)
matrix
- matrix with columns representing variables to correlate
public RealMatrix computeCorrelationMatrix(double[][] matrix)
matrix
- matrix with columns representing variables to correlate
public double correlation(double[] xArray, double[] yArray)
xArray
- first data arrayyArray
- second data array
DimensionMismatchException
- if the arrays lengths do not match
MathIllegalArgumentException
- if the array length is less than 2
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |