TITLE: Kendall tau calculation
QUESTION [6 upvotes]: Can someone explain how the Kendall tau works? I can't seem to find a good explaination/tutorial/example. I've been running corr(x,y,'kendall') from Matlab's Statistics Toolbox, but other than some output, it doesn't give me any good intuition. I've been stepping through with the debugger, but it gets confusing at times. I know that for two matrices, x and y must have the same number of rows, but that's about it. Is there a simple example that will illuminate what the Kendall p-value and Kendall tau really are?

REPLY [2 votes]: Came across this post and after using Kendall's $\tau$ a lot in the past few months, here is a resource that helped me. 
Spearman $\rho$ or Pearson's R measure linear correlation, but Kendall's Tau is much more like a $\chi^2$ test in that it just measures the strength of a relationship. It kind of measure monotonicity; if the values of x and y "go" in the same direction more often then "going" in different directions, expect a high $\tau$. 
Once you have a $\tau$ and a p-value, you can think about your data in the following way. 
$P_c/P_d = (\tau+1)(\tau-1)$
So if you have $\tau=0.6$, then randomly selected pairs $(x_i, y_i), (x_j, y_j)$ are 4 time more likely to be concordant than discordant, or 4 times more likely to "go" together than "go" apart. The p-value just gives a measure (in the frequentist perspective) how likely your $\tau$ is to be a false positive.