Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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! :)

share|improve this question
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

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$.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.