# [R] Multivariate dispersion & distances

Jari Oksanen jari.oksanen at oulu.fi
Thu Nov 28 15:35:25 CET 2013

```M Elo <merja.t.elo <at> luukku.com> writes:

>
> Dear All,
>
> I'm using betadisper {vegan} and I'm interested not only in the dispersion
> within the group but also the distances between the groups. With betadisper
> I get distances to group centroids but is it possible to get distances to
> other groups centroids?
>
> It might be possible to do it by hand by the formula given in the
> description of the betadisper (below) but I'm a bit confused how to treat
> the imaginary part there...
>
> z[ij]^c = sqrt(Delta^2(u[ij]^+, c[i]^+) - Delta^2(u[ij]^-, c[i]^-))
>
> I would highly appreciate all the help I can get!

Merja,

You should do it exactly in the same way as you wrote above: subtract the
squared Euclidean distances in the imaginary part from the squared
Euclidean distances in the real part and take the square root. I think
doing this by hand is the only way to do this directly. The scope of
the method is to compare dispersions within groups. There are other
tools to compare the locations of group centroids (adonis in vegan), but
they won't give you distances.

Cheers, Jari Oksanen

```