8
$\begingroup$

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.

Adding Problems

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.

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Erosennin Apr 12 '16 at 14:38
  • $\begingroup$ Yes, outcome1 and outcome2 are independent. $\endgroup$ – tschoppi Apr 12 '16 at 15:01
  • $\begingroup$ 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? $\endgroup$ – Scortchi Apr 12 '16 at 16:16
  • $\begingroup$ @Scortchi Could you elaborate on that independency statement? Could they not be independent because they occur at the same time? $\endgroup$ – Erosennin Apr 12 '16 at 19:41
  • $\begingroup$ @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 $\endgroup$ – Erosennin Apr 12 '16 at 19:44
0
$\begingroup$

I suggest do poisson regression separately on outcome1 and outcome2 (response variables) with class1, class2, class3 or class4 as explanatory variables.

You say that the classes are not exclusive, but this is not a problem if you take interaction between the classes into account. You can read more about interaction in the following post: Specification and interpretation of interaction terms using glm()

How to handle the dependency between the classes (in terms of doing a poisson regression), I see no way out of. You can measure the significance of the association with a chi-squared-test, and the strength of the association with Cramer's V. If this answers your question, I do not know.

$\endgroup$
  • $\begingroup$ I suspect (1) interest might focus on the counts of outcome 1 relative to outcome 2 & (2) ignoring the person/agent level may be unwise. $\endgroup$ – Scortchi Apr 13 '16 at 8:14
  • $\begingroup$ Will not (1) be answered with a comparison of the coefficients (output from regression) outcome1 and outcome2 ? $\endgroup$ – Erosennin Apr 13 '16 at 8:21
  • $\begingroup$ (1) Yes; but exactly how to compare them seems to be an important part of the question. (A convenient approach would be to treat 'outcome type' as a predictor of 'count' & to include all its interactions with 'class' variables. You'd have an bigger model encompassing your two separate regressions - it's a log-linear model for a multi-dimensional contingency table - but with the differences between them handily parametrized. Some might go further & turn it into a logistic regression model by conditioning out what they considered to be nuisance parameters.) $\endgroup$ – Scortchi Apr 14 '16 at 9:38
  • $\begingroup$ (2) The second point is more important. Tom & Dick smoke 20 & 35 cigarettes over a week; Harry & Pete, on some new anti-smoking treatment, 30 & 280. Do we assess the effectiveness of the treatment by comparing the total no. cigarettes smoked by people not using it, 55, to the total no. smoked by people using it, 310? $\endgroup$ – Scortchi Apr 14 '16 at 9:49
  • 1
    $\begingroup$ (1) See What test can I use to compare slopes from two or more regression models? for the general "one big model" idea, & then Log-linear regression vs. logistic regression & Germán Rodríguez on log-linear models. (2) A paired comparison of before after would be useful, I didn't mean to suggest that by my example though (sorry) - rather a hierarchical model. $\endgroup$ – Scortchi Apr 14 '16 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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