RankCorrel
Computes the weighted rank correlation between X and Y, equal to the correlation of the ranks of X with the ranks of Y.
Declaration =
Rank Correlation(X,Y : ContextSamp[I] ; I : IndexType=Run ; rankType : optional scalar=0 ; w : NonNegative ContextSamp[I] = SampleWeighting) ==
Detailed Description
(this description currently focuses on features new to 4.0. It needs a more general description.)
When there are duplicate values in X or Y, either the lower-rank, mid-rank, or upper-rank may be used in the correlation. The mid-rank is used by default (in 3.1 and earlier, the lower-rank was used). The optional rank_type parameter can be specified to override this default; -1 uses lower rank, 0 uses mid-rank, and +1 uses upper-rank.
Suppose the value 10 occurs 4 times in X, and that there are 25 values in X that are less than 10. You could think of those 4 values of x=10 occupying positions 26, 27, 28, and 29 in the sorted X. The lower rank for x=10 would be 26, the upper-rank would be 29, and the mid-rank would be 27.5.
Note: The Rank function uses the lower-rank by default, which is not the same default used by RankCorrel. This is a possible source of confusion, but there is a good reason for this. The mid-rank can be non-integer, so if Rank is used as a parameter to Slice, which is a very reasonable use of the Rank function, one want it to identify an actual element. However, there is no obvious reason why anyone would ever want to use anything other than a mid-rank in a rank-correlation. (Analytica 3.1 only offered lower-rank for both Rank and RankCorrel).
Enable comment auto-refresher