# Kendall's tau for two binary variables

I have to calculate many correlations with mostly ordinal variables and I use Kendall's tau for this. In some cases there is one binary and one ordinal variable and in some cases there are two binary variables. Can I use Kendall's tau for the last case, too? I know I could use other methods for this but I think it would be more consistent if I use Kendalls's tau all the time. Does this make sense? Here is the result of an example in R:

Data <- data.frame(A = sample(1:2, 30, replace = TRUE))
Data$$B <- as.numeric((Data$$A*0.9 + rnorm(30)) > 2)
table(Data$$A, Data$$B)
> cor.test(Data$$A, Data$$B, method = "kendall", alternative = "greater")

Kendall's rank correlation tau

data:  Data$$A and Data$$B
z = 1.6267, p-value = 0.0519
alternative hypothesis: true tau is greater than 0
sample estimates:
tau
0.3020793

$$$$


Yes, you can use Kendall's tau (-b) for two binary variables. The result should be similar to determining the correlation with phi.

The following is an example in R.

if(!require(psych)){install.packages("psych")}

set.seed(12345)

### remove set.seed for different samples

A = rep(c("A","B"),1,each=100)

X = factor(sample(A, 20))
Y = factor(sample(A, 20))

Table = xtabs(~X+Y)

Table

###        Y
### X   A B
###   A 8 5
###   B 4 3

library(psych)

phi(Table, digits=4)

### 0.0428

cor(x=as.numeric(X), y=as.numeric(Y), method="kendall")

### 0.04279605
`
• Thank you very much! Commented Dec 29, 2019 at 22:40