I have a categorical contingency table with many rows and a binary outcome, which I count:
name outcome1 outcome2 ---- -------- -------- A 14 5 B 17 2 C 6 5 D 11 8 E 18 14
This is all fine, because yet both categories (name and outcome) are independent within each other, i.e. person A cannot be person B at the same time, and outcome1 does not occur at the same time as outcome2.
However, I now want to enrich my data set by assigning classes to the agents. The classes are not exclusive, and some may even depend on each other. For the example above, with four classes Cx:
name C1 C2 C3 C4 ---- --- --- --- --- A 0 0 1 1 B 1 0 1 0 C 1 1 0 1 D 1 1 0 0 E 1 1 1 0
I now want to find out whether there is a dependence of one class on the outcome of the experiment.
Possible (naïve) Solution
My idea was initially to aggregate based on the class and then perform the independence tests, so that the table would look like this:
class outcome1 outcome2 ------ -------- -------- C3 49 21 not_C3 17 13
However, it then occurred to me that I mask out the influence of the other classes with this method, because I isolate based on class, which may give me bad results if some of the classes depend strongly on each other.
Also, my real data set contains about 200 agents and 30 categories, so my method would give a lot of results which I do now know how to interpret.
With this in mind, I turn to you: What statistical method is applicable to test (in-)dependence on a data set with one categorical non-exclusive variable and one binary categorical variable?
I would like to get some result along the lines of "Category 1 is the strongest predictor for the outcome (p < 0.01). It also correlates with Category 2."
Solutions using Python or R are more than welcome, but I don't need code. I need to know which method is applicable.