Skip to content
Prev 173074 / 398506 Next

rcorr.cens Goodman-Kruskal gamma

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.