diff --git a/src/site/xdoc/userguide/stat.xml b/src/site/xdoc/userguide/stat.xml index 4abbdc499..953e97be7 100644 --- a/src/site/xdoc/userguide/stat.xml +++ b/src/site/xdoc/userguide/stat.xml @@ -543,9 +543,11 @@ new NaturalRanking(NaNStrategy.REMOVED,TiesStrategy.SEQUENTIAL).rank(exampleData org.apache.commons.math.stat.correlation package computes covariances and correlations for pairs of arrays or columns of a matrix. - Covariance computes covariances and + Covariance computes covariances, - PearsonsCorrelation provides Pearson's Product-Moment correlation coefficients. + PearsonsCorrelation provides Pearson's Product-Moment correlation coefficients and + + SpearmansCorrelation computes Spearman's rank correlation.

Implementation Notes @@ -560,12 +562,19 @@ new NaturalRanking(NaNStrategy.REMOVED,TiesStrategy.SEQUENTIAL).rank(exampleData defaults to true.

  • - + PearsonsCorrelation computes correlations defined by the formula

    cor(X, Y) = sum[(xi - E(X))(yi - E(Y))] / [(n - 1)s(X)s(Y)]
    where E(X) and E(Y) are means of X and Y and s(X), s(Y) are standard deviations.
  • +
  • + + SpearmansCorrelation applies a rank transformation to the input data and computes Pearson's + correlation on the ranked data. The ranking algorithm is configurable. By default, + + NaturalRanking with default strategies for handling ties and NaN values is used. +
  • @@ -657,6 +666,20 @@ new PearsonsCorrelation(data).getCorrelationPValues().getEntry(0,1) between the two columns of data is significant at the 99% level.

    +

    Spearman's rank correlation coefficient
    +

    +
    To compute the Spearman's rank-moment correlation between two double arrays + x and y: + +new SpearmansCorrelation().correlation(x, y) + + This is equivalent to + +RankingAlgorithm ranking = new NaturalRanking(); +new PearsonsCorrelation().correlation(ranking.rank(x), ranking.rank(y)) + +
    +