0
$\begingroup$

I am interested in testing whether there is a correlation between a line and one or several rows in a contingency table.

Let's imagine this dummy dataset:

In rows, I have the types of meal that you can eat at a restaurant (pork, chicken, beef, tofu). I have hundreds of columns, each representing a specific situation, and I count how many times this situation was present when a client ordered a specific meal (for example, whether there was jazz, soul or classic music, whether it was raining, sunny, cloudy, cold, warm, whether it was day, whether it was night etc.) I have a dataset like

| Meal    | Jazz |Soul | Classic | Rain | Sun | Clouds | Daytime | 
| -------:|-----:|----:|--------:|-----:|----:|-------:|--------:|
| Pork    | 0    |10   |8        |1     |3    |5       |10       |
| Beef    |8     |1    |3        |5     |10   |8       |        4|
| Chicken | 9    |2    |0        |6     |11   |3       |        1|
| Tofu    | 8    |1    |3        |10    |8    |1       | 1       |

For example, pork was never ordered when there was jazz music, but was ordered 10 times when there was soul.

I want to know whether the choice of meal is impacted by one or several situations, i.e. what column(s) are statistically associated with each line. Importantly, I don't want to know whether the meal choice in general is associated with one or several columns, but whether each meal choice is associated with one or several columns (for example, "pork is mostly consumed when there is clouds and soul music)". I have the total number of meals, i.e. the total number of chicken meals, beef meals, etc that compose the dataset.

What I've investigated so far:

-Chi-square, but unfortunately, my columns are not mutually exclusive: One individual is sometimes in several columns, and it seems to prevent me from using this test.

-Correspondence analysis: Using an symetric plot (http://www.sthda.com/english/articles/31-principal-component-methods-in-r-practical-guide/113-ca-correspondence-analysis-in-r-essentials/) I can plot the situations as and see how the meals are correlated to these (i.e., whether they are close to the situation on the plot). However, I also need a numerical value, like a p-value, to express the strength of the association. Do you know what I could use?

Note: if needed, I can also work with raw data, i.e. a table with one row = one meal at the restaurant: I put 0 when the situation did not happen when the client ordered, and 1 when the situation happened when the client ordered. Something like:

| Event | Meal    | Jazz |Soul | Classic | Rain | Sun | Clouds | Daytime |
| -----:| -------:|-----:|----:|--------:|-----:|----:|-------:|--------:|
| 1     | Pork    | 0    |1    |0        |1     |0    |1       |0        |
| 2     | Beef    |1     |0    |0        |0     |1    |1       |1        |
| 3     | Chicken | 0    |1    |0        |1     |0    |1       |1        |
| 4     | Tofu    | 0    |0    |1        |1     |0    |0       |0        |

For example, the first customer ordered pork while there was soul music and it was rainy and cloudy.

$\endgroup$

1 Answer 1

0
$\begingroup$

I think that I've found an answer: I will do a Multiple Correspondence Analysis (MCA), which is originally designed for multiple answer questionnaires (columns are non exclusive and contain a yes or no value) and allows to investigate relationships between categories. More details about the R analysis and how to extract numerical values about the strength of association can be found in the book: Husson, François, Sébastien Lê, and Jérôme Pagès. Exploratory multivariate analysis by example using R. 2nd Ed. Boca Raton: CRC press, 2017.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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