# Determining correlation between continuous and binary (yes or no) data?

I am working with data from a survey with a sample size of 25, although not every question has 25 responses. We are looking at data from farmers. We are assuming that the data is normal, since we are treating our sample as the entire population. I have been using the pearson correlation coefficient for this. I have been treating values of R > 0.9 as significant, but when I am comparing continuous variables with binary variables (for example, land owned vs. do you use land for conservation purposes?), R is almost always < 0.9, even if they ought to correlate.

How do I find correlation between continuous and binary (yes or no) data? Should I just lower my threshold for significance? I suppose I could also split the data into two different groups based on whether they answer yes or no and see if the continuous values are significant between the two groups using Welch's t test, but this would be incredibly tedious.

Here is an example of what some of the data looks like:

Owned Acres Farmers using land for conservation
5 1
367 1
0 0
5 0
10 1
300 1
11 0
100 1
100 1
72 1
1.25 1
0 0
0 0
52 1
5 1
75 1
26 1
10 0
76 1
10 1
150 1
0 0
6.25 0
0 0
0 0

I have not taken any stats courses in college yet, so I apologize if this question seems silly.

• Welcome to Cross Validated! 1) Why do you treat your data as normal? 2) Why do you think you have the entire population when there are more than $25$ farmers in the world? 3) What does it mean to have a significant correlation? That term in statistics typically refers to a p-value from a hypothesis test, which you are not doing. 4) What’s wrong with the usual Pearson correlation? 5) Missing data (and a small sample size) might be big issues for you, and if your work is important (more than a class assignment), you might consider hiring a consulting statistician to address those and any others.
– Dave
Dec 30, 2022 at 20:32
• @Dave Thank you for the warm welcome. 1)&2) We are treating it as normal because it is our entire population. We are only doing descriptive statistics for our sample. We are not doing inferential statistics. Therefore, I want to see if, in our sample, different things are correlated. My PI said that we are effectively doing A/B testing. 3) Interesting. I thought that when R < 0.9, the variables are not correlated (I learned this in my intro psych course), although I have also read that R values differ depending on the discipline. Basically I am wondering, when does R mean something? Dec 30, 2022 at 20:50
• @Dave 4) Even if I had something really correlated, such as do you own land? and How much land do you own?, the R value is nowhere near being > 0.9 (I ran this analysis, and R = 0.3). Therefore, even when things are correlated, such as whether someone owns land and how much land someone owns, R < 0.9, just because I'm comparing binary data to continuous data. 5) The missing data would be cases where someone did not answer a question or cases where things did not apply to people (although, in this case, it can be fixed by entering 0 when it does not apply, such as how many cows they own). Dec 30, 2022 at 20:57
• The answer posted by @Michael Cooney is extremely good! I would only add that a Welch's t-test seems like the right test for you here - asking if there is a difference in the mean of Owned Acres for the two conservation groups. It is not that tedious, actually, and can be done easily in R, Python, or even Excel without much effort. Dec 30, 2022 at 23:04
• @KirkD_CO the problem is that I would not just be comparing land owned with whether they use it for conservation, I would be comparing it to about 20 more continuous variables. Additionally, I have around 30 more binary variables. I guess I’m wondering how I could make it quicker? Maybe I can’t, and I might just have to do it manually. Thank you for your help!! Dec 31, 2022 at 5:50

Pearson's correlation coefficient is measuring how well your data points fall on a straight line. If they fall almost perfectly on a straight line, you'll either have a correlation close to 1 or -1. Note: this isn't the slope of the line. You could have an extremely steep line and a nearly flat line that both have the same correlation. If you data isn't in a line, but a curve, you'll likely have correlation close to 0. If your data has a lot of variability, you also will have lower correlation. The pictures here help.

Now, if you only have 2 values, like your data, then having a curve is not possible. You'll only get a straight line. So if your correlation is lower, that means your binary data has a lot more variability than your other data. In practice, this is pretty common for binary measures. Often when you divide your population up into only 2 groups, each of those groups typically have a lot of variability (e.g. heights between men and women).

Here's a plot of your variables.

Farmers who use land for conservation have a large range and variability in acres owned. If you draw the "best" line between these two groups, there will still be a lot of distance between that line and all the individual points. The correlation here is 0.4621.

This is still a statistically significant value (p = 0.02), and judging by the plot, the effect size is fairly large, so the difference in groups is meaningful. It just doesn't land as perfectly on a straight line as other sets of data you have.

To see very high correlation, you'd need the conservation acres to be clustered all around the same value, like the non-conservation acres are. I replaced your data with a fabricated dataset where the conservation acres are all in the 300s. With this dataset, the correlation is 0.9922 with this scatterplot.

What is "high" correlation varies a lot with what industry you are in. If you are in physics, 0.9 correlation might be low. If you are in social sciences, 0.3 correlation might be high.

Best regards, Michael