tiedrank
statistics: [r, tieadj] = tiedrank (x)
statistics: [r, tieadj] = tiedrank (x, tieflag)
statistics: [r, tieadj] = tiedrank (x, tieflag, bidir)
statistics: [r, tieadj] = tiedrank (x, tieflag, bidir, tol)
x may be a vector or an array. An array is ranked along its first dimension, so a matrix is ranked column by column, and tieadj then carries one entry per column: its first dimension has length 1 by default, or 3 when tieflag is set, and its higher dimensions are those of x.
Compute rank adjusted for ties.
[r, tieadj] = tiedrank (x) computes the ranks of the
values in vector x. If any values in x are tied, tiedrank
computes their average rank. The return value tieadj is an adjustment
for ties required by the nonparametric tests signrank and
ranksum, and for the computation of Spearman’s rank correlation.
[r, tieadj] = tiedrank (x, 1) computes the ranks of
the values in the vector x. tieadj is a vector of three
adjustments for ties required in the computation of Kendall’s tau.
tiedrank (x, 0) is the same as tiedrank (x).
[r, tieadj] = tiedrank (x, 0, 1) computes the ranks
from each end, so that the smallest and largest values get rank 1, the next
smallest and largest get rank 2, etc. These ranks are used in the
Ansari-Bradley test.
[r, tieadj] = tiedrank (x, tieflag,
bidir, tol) treats two values as tied when they lie within a
tolerance of each other rather than only when they are exactly equal.
tol is either a scalar or an array the size of x giving each
element its own tolerance, and two neighbouring values are tied when the gap
between them does not exceed the sum of their two tolerances. The
default is 0, which is exact comparison. signrank uses this
to rank differences that are equal to within the precision of the values
they came from.
Source Code: tiedrank