# Correlation Test Between a Categorical Variable and an Ordinal (In the form of a ranking) Variable

I have a dataset of book sales by rank and the color of the cover. I would like to find a relationship between the rank of the book and the color of the cover.

I'd like to know how to do this analysis in R.

This is how the dataset looks like:

Book MainColor SecondaryColor Ranking
Book 1 White Black 1
Book 2 White Black 2
Book 3 Yellow Red 3
Book 4 Yellow Black 4
Book 5 Pink White 5
Book ... ... ... ...

I'm new to stackexchange and statistics.

If you hve had only one color variable, you could use the rank-basded alternative to one-way anova, which is the Kruskal-Wallis test, see for instance Kruskal-Wallis test data considerations.

But you have two color variables, so the situation is analogous to two-way anova. I would try user Frank Harrell's answer at Is there an equivalent to Kruskal Wallis one-way test for a two-way model?. For an example (with R code) see Which model should I use to fit my data ? ordinal and non-ordinal, not normal and not homoscedastic

• I've searched about the Proportional Odds model, and it seems it is used when you have 2 ordinal variables, which is not the case here. I have one ordinal variable (Book Rank) and one nominal variable (Color) which does not have an order. I've seem this in this book in 7.1.2 Commented Feb 7, 2022 at 18:35
• NO, proportional odds assume an ordinal response, which you have (ranks). Then you have two factor variables (MainColor, SecondaryColor) which you use as predictors. I have added to the answer. Commented Feb 8, 2022 at 16:14