HomeTechniques and TipsCorrelation in @RISKHow @RISK Computes Rank-Order Correlation

# 5.14. How @RISK Computes Rank-Order Correlation

Applies to: @RISK 5.5.0 and later

The RiskCorrel( ) function can return the Pearson product-moment or Spearman rank-order correlation coefficient.  How is the rank-order coefficient computed?

@RISK uses the method in Numerical Recipes by Press, Flannery, Teulosky, and Vetterling (Cambridge University Press; 1986), pages 488 and following.

Each number in each of the simulated distributions is replaced with its rank within that distribution, as an integer from 1 to N (number of iterations).  If the values in a distribution are all different, as they usually are with continuous distributions, then the rank numbers will all be distinct.  If there are duplicate numbers within the distribution, as often happens with discrete distributions, then "it is conventional to assign to all these 'ties' the mean of the ranks that they would have had if their values had been slightly different.  This [is called the] midrank" (quoting from the reference book above).

Once the ranks are obtained, the rank-order coefficient is simply the Pearson linear correlation coefficient of the ranks.

The above explains how @RISK computes rank-order correlation after a simulation is complete.  @RISK also uses rank-order correlation within a simulation, when drawing numbers for correlated distributions.  This page gives details: How @RISK Correlates Inputs.

Last edited: 2015-06-23