# Statistical association test between ordered and unordered variable

I want to test the association between 2 variables : - one is an ordered factor from quantiles of a numeric value ("Q1", "Q2", "Q3", "Q4") - the other is an unordered factor from groups of a character value ("group A", "group B", "group C").

If I make a usual chi square test, I get the association between those variables.

Is there a way I can't take into account the ordering of my first variable ? If yes, which test is appropriate ?

• Feb 12 '18 at 8:29
• @JarleTufto I'm taking a look, this seems very interesting but this is modelization, isn't it a bit of an overkill ? I was more looking for some kind of test if it exists. Feb 13 '18 at 10:08
• If you do an overall test you find there is an association but not what it is, nor where. If you use an ordered categorical model you see more clearly what is going on which is why @JarleTufto and I would do that. Feb 13 '18 at 12:57

As illustrated by the R example below, given that the assumptions of the ordinal regression model are satisfied, you gain statistical power by testing for an effect of the factor group in an ordinal regression model (it's one line of code) as compared to testing for any kind of deviation from independence between your response (y below) and group via a chi-square test.

> # Simulated data
> n <- 30
> group <- factor(rep(c("A","B","C"),each=n))
> set.seed(1)
> z <- rnorm(3*n, mean=c(0,.5,1)[group],sd=1.5) # unobserved latent variable
> y <- rep(0,3*n)
> y[z>0] <- 1
> y[z>1] <- 2
> y[z>2] <- 3
> table(y,group)
group
y    A  B  C
0 13  9  6
1  9  7  6
2  6 10 12
3  2  4  6
>
> # Fit the model
> y <- ordered(y)
> library(MASS)
> anova(polr(y ~ group), polr(y ~ 1))
Likelihood ratio tests of ordinal regression models

Response: y
Model Resid. df Resid. Dev   Test    Df LR stat.    Pr(Chi)
1     1        87   241.1152
2 group        85   234.1001 1 vs 2     2 7.015068 0.02997073
>
> # Compare to a chi-square test
> chisq.test(table(y, group))

Pearson's Chi-squared test

data:  table(y, group)
X-squared = 7.2792, df = 6, p-value = 0.2958

• Very interesting, thank you for your answer. What I understand is that to test the ordered association, you compare the model ordinal~groups to the model ordinal~1. But how does this take account of the order ? Also, how do you see the actual gain of power in your output ? And to be fully annoying (sorry), is there any way to get this concept using base R models (like lm, glm, aov etc) ? Feb 15 '18 at 10:05
• The order is specified by defining y as an ordered factor (with the ordered function). The increased power is only indicated by the $p$-values under the two approaches. To truly see the gain in power you would need to simulate a large number of data sets under $H_1$ and then estimate the probability of rejecting $H_0$ under each approach. But in general, you are more likely to reject $H_0$ if your alternative $H_1$ is more specific. In the above case, $H_1$ has $3+2=5$ parameters in the ordinal regression whereas $H_1$ under the chi-square test has $3\times 4 -1=11$ parameters. Feb 15 '18 at 10:18