[R-sig-eco] How to calculate a community similarity index not supported by vegan
Jari Oksanen
jari.oksanen at oulu.fi
Sat Apr 3 08:48:31 CEST 2010
On 2/04/10 07:18 AM, "Qi Li" <ericqili at hotmail.com> wrote:
> Hi,
> I have to calculate similarity in community composition(in a community
> matrix) as the probability of randomly drawing two individuals of the same
> species at each pair of sampling points.
> The details as follows:
> For two plots, the probability F can be calculated as F =sum (fi1*fi2), where
> fij is the relative abundance of species i at site j, and the sum is
> over all species at both sites.
> I did not find any functions in library vegan and ecodist to calculate this
> index. Can anyone help on this?
Dear Qi Li,
I am not quite sure I understand correctly what you want to achieve, but it
looks to me like you want to have a crossproduct of a matrix standardized to
unit row sums. With more words: (1) you want to standardize your data so
that your rows have unit sum so that species are expressed as relative
abundances, and (2) then you want to have a sum of products of these
relativized values for each pair of sites.
There are many ways of doing this (if this was what you wanted to do). In
vegan you can use decostand() for the first task, and designdist() for the
second:
designdist(decostand(dune, "tot"), "J", terms="quadratic")
This will give similarities, but vegan and all standard R functions expect
dissimilarities. So you may consider asking for probabilities of randomly
drawing individuals of *different* species, or
designdist(decostand(dune, "tot"), "1-J", "quadratic")
There are many other ways of doing this, though, as method = "J" with terms
= "quadratic" in designdist() is just a crossproduct (or tcrossprod()).
I am not sure if this was what you wanted to have, but you can see if you
can define your method with designdist() which allows you design your sweet
own dissimilarity indices.
Cheers, Jari Oksanen
More information about the R-sig-ecology
mailing list