[R-sig-eco] Dissimilarity ranking

Dave Roberts dvrbts at ecology.msu.montana.edu
Fri Dec 10 00:39:26 CET 2010


Well, it was not only a little sloppy, but a little late.  Reading 
further I saw others had made the same suggestion a while ago. 
Nonetheless, that will remind me to paste my emails into R and check.

Thanks François

On 12/09/2010 03:34 PM, francois Guilhaumon wrote:
> Dear all,
>
> I would like to point out three small mistakes in Dave's code, which of
> course are certainly typos.
>
> If one wants to not get only NAs in the result vector, one should
> specify na.rm=TRUE in the apply statement, furthermore I guess that
> the mean function has to be applied to 'demodis2' and not 'dimodis'
> which is an object of class 'dist', finally there is no need to
> transform 'demodis' again using the as.matrix function in the apply
> statement:
>
> demodis2<- as.matrix(demodis)   # make a full matrix copy
> is.na(diag(demodis2))<- TRUE    # ignore the dissimilarity of a
>                                    # plot to itself
> apply(demodis2,1,mean,na.rm=TRUE) # calculate the mean dissimilarity
>                                    # of every plot to the others
>
> I checked the code, it's now working.
>
> Cheers,
>
> François.
>
> 2010/12/9 Dave Roberts<dvrbts at ecology.msu.montana.edu>:
>> Burak,
>>
>>     I think your question is simpler than the suggestions of NMDS.  One
>> approach, let's say you dissimilarity matrix is called demodis
>>
>>> demodis2<- as.matrix(demodis)   # make a full matrix copy
>>> is.na(diag(demodis2))<- TRUE    # ignore the dissimilarity of a
>>                                    # plot to itself
>>> apply(as.matrix(demodis),1,mean) # calcualte the mean dissimilarity
>>                                    # of every plot to the others
>>
>>
>> This is all done as part of function disana() in package labdsv along with
>> some other simple dissimilarity analyses.
>>
>> Dave Roberts
>>
>>
>>
>> On 11/23/2010 01:09 PM, Pekin, Burak K wrote:
>>>
>>> Hello, I want to rank the dissimilarity of sites based on their species
>>> composition. For example, I would like to be able to say that site A is less
>>> similar in composition to the other sites than site B is similar to the
>>> other sites. I could do a cluster analysis and look at which sites are less
>>> closely clustered.
>>>
>>> It would be even better if I could come up with a quantitative scale
>>> rather than a relative ranking that would give a value for each site based
>>> on its relative dissimilarity to the rest of the sites. So site A might
>>> receive a 90 out of 100, whereas site B and C might receive a 60 and a 50
>>> indicating the rank as well as 'relative quantity' of dissimilarity for each
>>> site.
>>>
>>> Thanks,
>>> Burak
>>>
>>> --------------------------
>>>
>>> Burak K. Pekin, PhD
>>> Postdoctoral Research Associate
>>> Purdue University
>>>
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-ecology mailing list
>>> R-sig-ecology at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>> _______________________________________________
>> R-sig-ecology mailing list
>> R-sig-ecology at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
David W. Roberts                                     office 406-994-4548
Professor and Head                                      FAX 406-994-3190
Department of Ecology                         email droberts at montana.edu
Montana State University
Bozeman, MT 59717-3460



More information about the R-sig-ecology mailing list