Rank adjusted for ties
[R,TIEADJ] = tiedrank(X)
[R,TIEADJ] = tiedrank(X,1)
[R,TIEADJ] = tiedrank(X,0,1)
[R,TIEADJ] = tiedrank(X)
computes
the ranks of the values in the vector X
. If any X
values
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.
Counting from smallest to largest, the two 20 values are 2nd and 3rd, so they both get rank 2.5 (average of 2 and 3):
tiedrank([10 20 30 40 20]) ans = 1.0000 2.5000 4.0000 5.0000 2.5000
tiedrank
treats NaN
s in X
as missing values and ignores them. The rank of NaN
s in the output
argument R
is NaN
.
ansaribradley
| corr
| partialcorr
| ranksum
| signrank