[R] rcorr.cens Goodman-Kruskal gamma

Frank E Harrell Jr f.harrell at vanderbilt.edu
Mon Mar 9 19:27:29 CET 2009


David Winsemius wrote:
> 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.

Yes rcorr.cens was designed to handle censored data but works fine with 
uncensored Y.  You may need so specify Surv(Y) but first try just Y.  It 
would be worth testing the execution speed of the two approaches.

Frank

-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list