The origin of the shadow value is calculated in the shadow
function of the flexclust package, in which it is based on the first and
second closest centroid. The msv function in this package modifies
the centroid into medoid such that the formula to compute shadow value of
object i is
$$msv(i) = \frac{d(i, m'(i))-d(i, m(i))}{d(i, m'(i))}$$
where \(d(i, m(i))\) is the distance between object i to the first
closest medoid and d(i, m'(i)) is the distance between object
i to the second closest medoid.
The idmedoid argument corresponds to the idcluster argument.
If the length of idmedoid is 3, for example, the idcluster has
to have 3 unique cluster memberships, or it returns Error otherwise.
The length of the idcluster has also to be equal to n
(the number of objects). In contrast to the centroid shadow value,
the medoid shadow value is interpreted likewise a silhoutte value,
the higher value the better separation.