[R] rcorr.cens Goodman-Kruskal gamma

David Winsemius dwinsemius at comcast.net
Mon Mar 9 16:44:25 CET 2009


I looked at the help page for rcorr.cens and was surprised that  
function, designed for censored data and taking input as a Surv  
object, was being considered for that purpose.  This posting to r-help  
may be of interest. John Baron offers a simple implementation that  
takes its input as (x,y):

http://finzi.psych.upenn.edu/R/Rhelp02/archive/19749.html

goodman <- function(x,y){
   Rx <- outer(x,x,function(u,v) sign(u-v))
   Ry <- outer(y,y,function(u,v) sign(u-v))
   S1 <- Rx*Ry
   return(sum(S1)/sum(abs(S1)))}

I then read Frank's response to John and it's clear that my impression  
regarding potential uses of rcorr.cens was too limited. Appears that  
you could supply a "y" vector to the "S" argument and get more  
efficient execution.
-- 
David Winsemius

--
On Mar 9, 2009, at 11:13 AM, Kim Vanselow wrote:

> Dear r-helpers!
> I want to classify my vegetation data with hierachical cluster  
> analysis.
> My Dataset consist of Abundance-Values (Braun-Blanquet ordinal  
> scale; ranked) for each plant species and relevé.
> I found a lot of r-packages dealing with cluster analysis, but none  
> of them is able to calculate a distance measure for ranked data.
> Podani recommends the use of Goodman and Kruskals' Gamma for the  
> distance. I found the function rcorr.cens (outx=true) of the Hmisc  
> package which should do it.
> What I don't understand is how to define the input vectors x, y with  
> my vegetation dataset. The other thing how I can use the output of  
> rcorr.cens for a distance measure in the cluster analysis (e.g. in  
> vegan or amap).
> Any help would be greatly appreciated,
> Thank you very much,
> Kim
>




More information about the R-help mailing list