On 18/07/11 13:39 PM, "Gavin Simpson" <gavin.simp...@ucl.ac.uk> wrote:

> On Sun, 2011-07-17 at 15:51 +0200, magali proffit wrote:
>> Dear all,
>> linked to MRPP in Vegan there is a really nice function (meandist)
>> which calculates a matrix of mean of distance, based on a grouping
>> factor, from matrices of dissimilarity. I was wondering if there is an
>> equivalent function calculating the standard deviation instead of the
>> mean distance or if anyone has an idea how to do it.
>> thanks a lot!
>> Magali
> 
> meandist() computes the mean within and between block dissimilarities.
> Do you want the within block standard deviation of dissimilarities and
> the between block standard deviation of dissimilarities?
> 
> If so, you could just grab the sources for meandist and change this
> line:
> 
> out[take] <- tapply(dist, cl, mean)
> 
> to be
> 
> out[take] <- tapply(dist, cl, sd)
> 
> (or use `var` in place of `sd` if you want the variance instead of the
> standard deviation.) ...[cut]...

You can do like Gav suggests in this message, but it is better to use the
function betadisper() that Gav wrote for the vegan package. Gav's betadisper
does things more correctly. It doesn't use SD or variance directly, but it
gives you dispersion for classes: I have no idea what is the SD of
*dissimilarities* (and the same applies for the averages of
dissimilarities), but betadisper() gives you meaningful values.

Cheers, Jari Oksanen

_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

Reply via email to