# Correlation between two binary data sets

I am unsure how to do this properly. I have two binary data sets, i.e. values in each data set is either 1 or 0. I now wish to see if they are in any way correlated. I could use Pearson's, but I don't know if that is applicable to binary data as well ?

Basically I just have data that looks something like this:

x = [1, 0, 0, 0, 0, 0, 1, 1, 1, 0]
y = [1, 0, 0, 0, 1, 0, 1, 0, 1, 0]


What I am trying to do is check whether my colleague is correct or not. He has stated that some particular set of data correlates with another set of data, and he therefore wants to discard/remove data points corresponding to where the value is 1 in x, i.e. 40% here. So that would mean I would reduce (in this example) my data with 4 cases. So before doing that I just want to make sure that he/we are correct.

• I'm not sure I've fully understood, because x and y are correlated, your colleague wants to delete all data points where x=1 ? He effectively wants to recast the data as y=y[x!=1] and x=x[x!=1] ? Why is this a logical thing to do if x and y are correlated? – gazza89 Sep 19 '18 at 13:36
• Basically some of the data we have is used for model fitting, i.e. getting some parameters for this model. So this model should be able to calculate an expected outcome if the data used is similar to ours. However, he says that the above data correlates with the observed outcome (not the predicted that our model has to predict). So in order to get a model that is more correct on most data, the best thing would be to remove it. So it's like if I want to figure out if longer legs means greater running speed. But if some people only have one leg, that would not represent it well in this case. – Denver Dang Sep 19 '18 at 13:51
• I still can't say I understand. In that analogy, is x "number of legs", y "running speed" and the thing you're trying to predict is "time taken to run 100m" ? And you only want to predict the target for people with two legs? Then it's trivial, you throw away all data points for people with 1 leg. I suspect however, what your colleague is saying is that x and y are correlated so using both contains redundant information? This isn't a problem per so, plenty of classifiers can deal with correlated features very naturally (e.g. decision trees) – gazza89 Sep 19 '18 at 13:55
• Yes, okay, that was indeed a bad example from me. This is not as straightforward as just one leg... I'll rephrase. Let's assume y is some kind of observed side effect. My colleague then says that there is a large correlation between people with side effects and some drug they have taken. The idea is, since it is strongly correlated, that we just throw away patients where we know they have received this drug pre-treatment since that would probably skew the overall model fitting. – Denver Dang Sep 19 '18 at 14:08
• if y is a side effect, is x a pre-treatment, and you only want to model your target variable for people who did not receive the pre-treatment ? – gazza89 Sep 19 '18 at 14:27