The origin of the centroid 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 csv function in this package modifies
the centroid into medoid such that the formula to compute shadow value of
object i is
$$csv(i) = \frac{2d(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 silhoutte value,
the centoird shadow value is interpreted that lower value is the better
cluster separation.