Introduction

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.

The Question

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.

• outcome1 and outcome2 are independent as well? You only say they do not happen at the same time. I imagine you could do poisson regression here, if you want to measure the dependence of multiple variables on the outcome. But this could be a problem if your explanatory variables are very dependent. Apr 12, 2016 at 14:38
• Yes, outcome1 and outcome2 are independent. Apr 12, 2016 at 15:01
• If "outcome1 does not occur at the same time as outcome2", they are certainly not independent. It would help to explain the context - exactly what observations are you making for each person? Apr 12, 2016 at 16:16
• @Scortchi Could you elaborate on that independency statement? Could they not be independent because they occur at the same time? Apr 12, 2016 at 19:41
• @tschoppi you write: "Now, I want to assign (by hand) classes to these people, and then test if the output depends on one of the classes. My problem is that the classes, while not necessarily dependent on each other, are not exclusive. The classes can however be dependent on each other.". The fact that they are exclusive you could solve by making them interact with each other when specifying the poisson regression. If I'm not completely off track here misunderstanding your data and question Apr 12, 2016 at 19:44