Measures of association in R — Kendall's tau-b and tau-c

前端 未结 9 859

Are there any R packages for the calculation of Kendall\'s tau-b and tau-c, and their associated standard errors? My searches on Google and Rseek have turned up nothing, but su

9条回答
  •  难免孤独
    2021-01-30 10:03

    Just to expand of Stedy's answer... cor(x,y,method="kendall") will give you the correlation, cor.test(x,y,method="kendall") will give you a p-value and CI.

    Also, take a look at the Kendall package, which provides a function which claims a better approximation.

    > library(Kendall)
    > Kendall(x,y)
    

    There is also the cor.matrix function in the Deducer package for nice printing:

    > library(Deducer)
    > cor.matrix(variables=d(mpg,hp,wt),,
    + data=mtcars,
    + test=cor.test,
    + method='kendall',
    + alternative="two.sided",exact=F)
    
                              Kendall's rank correlation tau                          
    
               mpg     hp      wt     
    mpg    cor 1       -0.7428 -0.7278
             N 32      32      32     
        stat**         -5.871  -5.798 
       p-value         0.0000  0.0000 
    ----------                        
     hp    cor -0.7428 1       0.6113 
             N 32      32      32     
        stat** -5.871          4.845  
       p-value 0.0000          0.0000 
    ----------                        
     wt    cor -0.7278 0.6113  1      
             N 32      32      32     
        stat** -5.798  4.845          
       p-value 0.0000  0.0000         
    ----------                        
        ** z
        HA: two.sided 
    

提交回复
热议问题