# What type of statistics to use to show correlation between two discrete sets of data?

I have two variables, each with the same set of 5 unranked possible values (let's call them A/B/C/D/E), and a set of data such as the following (A/A, A/D, B/B, D/D, E/E, B/A etc), where the first letter is the value of the first variable and second letter is second variable. How would I show correlation between the statistics i.e. to show high probability of the two variables being the same letter?

Sorry if this is not clear, and thanks in advance for any help! :)

-
There are a variety of measures of association in contingency tables a few are listed here, but the suggestion by @PeterFlom of Cohen's kappa is about as good as you will get for this particular case. – Glen_b Mar 6 '13 at 11:05

## 1 Answer

You actually ask two questions here, one of which is meaningless and the other meaningful (but which may not be what you mean).

First, you ask what is the correlation between two discrete and unordered variables. This question doesn't make sense. The correlation is not defined for two discrete, multi-category variables. Then you ask

i.e. to show high probability of the two variables being the same letter

You can show the probability simply by adding up the cases of A/A, B/B etc and dividing by the total number of cases, but if you want a statistic of agreement, you can look into Cohen's $\kappa$,

$\kappa = \frac{Pr(a)-Pr(e)}{1-Pr(e}$

where $Pr(a)$ is the probability of agreement and $Pr(e)$ is the probability of chance agreement. There are online calculators for this; it is also available in R, SAS, etc. There are also weighted versions, if some disagreements are worse than others.

But if you want to see if two discrete variables are related in a more general sense, you may want $\chi^2$.

-