# Testing for correlation with count data

I am attempting to test the correlation between two variables:

Predictor: Count data (not ranked)

Response: Continuous

Because my predictor variable is not continuous, I cannot use Pearson's, correct? However, because it is also not rank data, I cannot use Spearman's, yes?

What test for correlation would you guys suggest?

edit: Response to @whuber:

Perhaps I am misunderstanding "rank".

My predictor variable is the size of a group and my response variable is essentially the score that a group receives on a test.

I am testing to see if there is a correlation between group size and score.

My thought is that because a group size of n-1 isn't necessarily "better" than a group size of n (like how 1st place is better than 2nd), the data is not "ranked".

• Often correlation is not very specific nor of much interest. Could you tell us a little more about what you really want to find out? And what do you mean by "not ranked," given that there is a natural and universal sense in which one count is considered greater than another: it represents more things?
– whuber
Commented Apr 27, 2017 at 23:00
• @whuber - I added an edit Commented Apr 27, 2017 at 23:06
• The statement that Pearson's cannot be used with discrete data is not correct. It can be used; correlation is still correlation. In some situations you should not expect association to be linear (whether or not it's continuous) and you may not be able to use the usual normal-theory tests or intervals but that doesn't necessarily make the measure of correlation invalid. Can you explain more about the situation, the variables and why you want to look at correlation? What is it you're trying to find out? Commented Apr 28, 2017 at 0:01
• You might be interested in the nuances of Pearsons' correlation with normal vs. non-normal data having a linear association in the selected answer to the question Pearson's or Spearman's correlation with non-normal data Commented Mar 21, 2018 at 17:47

You misunderstand Spearman's rank correlation coefficient: the method is not for measuring linear association on rank data (per se), but a method for measuring monotonic association (ordinal association) of data (of whatever distribution) by using the ranks of those data.

To calculate Spearman's $r_{S}$ you simply:

1. rank each of your variables separately
2. calculate Pearson's $r$ using those ranks, rather than the unranked data.

So Spearman's $r_{S}$ is fine for your purposes. (As is Kendall's $\tau$, and the general correlation coefficient.)

There are two ways I would approach this problem.

Depending on how many members your groups have, you could in fact consider group size to be a continuous variable. In that case, assuming that both 'score' and 'group size' are normally distributed and you have enough cases (depends on who you ask, some suggest at least 30, but it is contentious), you could run a Pearson's and/or a Spearman's correlation test.

On the other hand, if for whichever reason your 'group size' variable is not normally distributed (and assuming that 'score' is, and you have enough observations), you could also run a linear model (an ordinary least squares linear regression) with 'score' as your dependent variable and 'group size' as your independent variable (i.e. your predictor).