For a university course, a friend of mine had to test whether there is a relation between two ordinal variables. These variables were opinion about the European Union (positive, neutral, negative) and whether people felt being (a) citizen of their country, (b) primarily citizen of their country, but also European, (c) primarily European, but also citizen of their country and (d) European. The data is available in form of a contingency table.

Now, what my friend did was to calculate a chi-squared test. I believe this is wrong, because it does not consider the fact that the groups are ordered, i.e. the variables are ordinal and not categorial. However, chi-squared test seems to be common for this kind of analysis (e.g. here).

In my opinion, the idea behind this question is whether or not there is a significant correlation between those variables, and since Pearson’s correlation cannot be calculated from ordinal data, Spearman’s Rho should be used. An alternative to that would be Goodman’s/Kruskal’s Gamma test, as suggested here. Perhaps the Kruskal Wallis test would also be an option? But can it be used in this setting?

So, my first question is: Is it valid to use the chi-squared test here? What do you think of the alternatives I described?

Question two: How can the significance of Spearman’s correlation be calculated in R? It seems to me most commands reqire observations, not contingency tables, as input.

  • $\begingroup$ Spearman's $\rho$ as well as Kruskal-Wallis are for ordinal continuous variables, whereas your variables or ordered categorical ones. It seems like you could have a look at the linear-by-linear test suggested by Agresti (Introduction to Categorical Data Analysis, 2007, p229 ff). It is implemented in R in function lbl_test() from package coin. $\endgroup$ – caracal May 9 '12 at 12:45
  • $\begingroup$ What is the difference between ordinal continuous and ordered categorical variables? After all, I could always code the categories with values ranging from 1–4 or 1–3. (And this is what I suppose R is doing when it calculates Spearman’s ρ in my data.) $\endgroup$ – mzuba May 9 '12 at 16:34
  • $\begingroup$ Assigning numerical scores to categories is what's happening in the LBL-Test, but then the variable still can take on only finitely many values. Continuous vars can take on uncountably infinitely many values. Spearman's $\rho$ is Pearson's correlation for ranks. To derive the distribution of the test statistic, you need unique ranks, i.e., zero probability of ties (equal values, hence ranks). For this you need continuity. With only a few categories, many ties are guaranteed, there are different ways to assign ranks (mid-ranks, ...), and the distribution of the test statistic is not available. $\endgroup$ – caracal May 10 '12 at 8:36

The chi square test is not optimal although it will often give sensible answers. Amongst other problems it does not give you any sense of the direction of the relationship between the two variables - because, as you say, it ignores the ordered nature of them

Better is a polychoric correlation. You can put a bootstrap around it to test for significant evidence against a null hypothesis of no correlation, or to estimate a confidence interval for the size of the correlation.

On your second question (and you probably need this also if you want to bootstrap a polychoric correlation) - even if all you have is a contingency table, it is straightforward to reverse engineer a set of observations. The expand.table() function in the epitools package in R is one way to do this, but I am sure it could be done in other software too.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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