Site icon R-bloggers

Kendall’s Rank Correlation in R-Correlation Test

[This article was first published on Methods – finnstats, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Kendall’s Rank Correlation in R, Kendall’s rank correlation coefficient is suitable for the paired ranks as in the case of Spearman’s rank correlation.

The condition is that both the variables X and Y be measured on at least an ordinal scale.

One advantage of Kendall Tau over Spearman’s rank correlation is that tau can be generalized to a partial correlation coefficient which is not possible in the case of rs.

What are the differences between Association and Correlation? »

Procedure

The procedure of Kendall τ consists of the following steps.

Step1:- Arrange the rank of the first set (X) in ascending order and rearrange the ranks of the second set (Y) in such a way that n pairs of rank remain the same.

Step2:-The ranks of X are in the natural order. Now we are left to how many pairs of ranks in the set Y are in a natural order and how many are not.

Significance of Spearman’s Rank Correlation »

A number is said to be in natural order if it is smaller than the succeeding number and is coded as +1. And also if it is greater than its succeeding number then it will not be taken as a natural order and will be coded as -1.

Step3:-Find the sum of all coded values.

Step4:- The formula for Kendall tau is

τ=2S/n(n-1)

Properties

Kendall’s tau range between -1 to 1.

If n is large Kendall’s τ equal to the 2/3 rd of Spearman’s rank correlation.

Correlation Analysis Different Types of Plots in R »

If τ=1 indicates the ranking of X is in the same order as the ranking of Y.

If τ=-1 indicates the ranking of X is in reverse order of the ranking of Y.

Kendall’s Rank Correlation in R

Let’s see how to execute Kendall’s τ in R.

x<-c(1,2,3,2,1,3,4,2,5,2,6,5,5)
y<-c(5,5,6,2,1,4,4,2,1,2,1,5,5)
res<-cor.test(x,y, method="kendall")
res

Kendall’s rank correlation tau

data:  x and y
z = 0.12931, p-value = 0.8971
alternative hypothesis: true tau is not equal to 0
sample estimates:
       tau
0.03030651

Conclusion

The correlation coefficient between x and y is 0.03030651and the p-value is 0.8971.

Correlation Analysis in R? » Karl Pearson correlation coefficient »

The post Kendall’s Rank Correlation in R-Correlation Test appeared first on finnstats.

To leave a comment for the author, please follow the link and comment on their blog: Methods – finnstats.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.