calc.nswaps {MDSMap} | R Documentation |
Calculates the number of swaps required to move from one order to another.
Description
Calculates the number of swaps required to move from one order to another.
Usage
calc.nswaps(map1, map2)
Arguments
map1 |
Vector of marker positions or ranks. |
map2 |
Vector of marker positions or ranks. |
Details
This is intended to be used when comparing an estimated marker ordering to
some perceived "truth". It is most likely to be useful when dealing with
simulated data where the concept of truth makes most sense. It calculates
the minimum number of single place swaps that would be needed to move from
map1
to map2
and it does this by reverse engineering kendall's tau b
correlation coefficient
\tau=\frac{2(C-D)}{N}
where N
is the total number of pairs of markers, C
the number of concordant pairs and D
the number
of discordant pairs. If there are n
markers then the total number of pairs
N={{n}\choose{2}}
and C=N-D
so D=0.5 {{n}\choose{2}}(1-\tau)
and the minimum
number of swaps is the minimum of D
and N-D
Value
Scalar giving the number of swaps.