# Correlation between a percentage and a real number

I have two datasets, one containing the percentage of people with flu and one which has the number of searches for Tea-recipes in google. Problem is, I get different results when i choose to include the percentage number instead of the real number of people with flu.

Im using Excel function Correl(peoplwithflupercentage, teasearches)

My question is, can I somehow use percentages to look for correlation with real numbers. Like correlation between a dataset (percentage numbers) and another dataset (real numbers)? I know this probably is a simple question, but can't seem to find a good example in the forum or google.

## 3 Answers

Yes - you can certainly compare the correlation between %'s and whole numbers. The Excel Correl function uses Pearson's $r$ to calculate correlation. The formula for $r$ (found in the link above or here) is invariant to changes in scale and location of your $X$ or $Y$ variables. That is, you can multiply the $X$'s or $Y$'s by a constant and it won't change their correlation.

Here is an example in R:

## random X's and Y's
x <- c(1,2,3,4,5)
y <- c(10,8,6,4,2)
cor(x,y,method='pearson')
## output
 -1
## now multiply your whole numbers by a constant to make them proportions
x <- x*0.01
cor(x,y,method='pearson')
## output
 -1


Adding to the answer of @ilanman, yes, you can certainly use correlation between a percentage and a numerical variable.

If (some of) the percentages are close to zero% or 100%, though, there could be an "saturation effect". Lets say the variables are perc and x, and there is really some (causal) connection between x and perc, say, which we could have modelled via a logistic regression model. Then the linear relationship is really between x and the log odds corresponding to perc. But however, the log odds function is close to linear except near the limits of zero and one, so except in some very extreme cases, the correlations calculated between x and perc, and between x and (logodds of perc), will be numerically very close.

And, adding to the answer of @Yash, what he shows is a very different phenomenon (and maybe more important). Such a huge difference as 0.1 and 0.9 cannot come from my explanation above, it comes from a large variation in the denominators. If his unemployment data compares countries (or maybe states in the USA), then the denominators will be population size. So his correlation of 0.1 measures correlation between GDP and % unemplyment, his correlation of 0.9 is in reality more of correlation between GDP and population! If his GDP is total (and not per capita, he did'nt specify) that is not surprising. So in that case, the two correlations of 0.1 and 0.9 really measures totally different things.

• This was very helpful! Would this example of accidentally measuring the correlation between GDP and population (and thus getting a very high result) be the same theory if you were measuring vote totals against attempts to those voters in different-sized precincts? I'm seeing very high correlations there but nervous that it's because larger precincts have more people and thus there are more of them to reach out to. Cause when I look at % turnout vs % attempted those numbers drop. Hope this was an appropriate use of a clarifying comment on this thread, thanks! – Ryan Jul 6 '18 at 21:02

There is a difference, when I took % for employment growth and GDP in Millions, the result came up as (0.1) but when I changed employment to no of persons in thousands, it worked and got a positive correlation coefficient of (0.9).

• This is no surprise; the variables are different if the denominator of the growth rate was different, as is true in practice. It doesn't bear on the question. – Nick Cox Mar 10 '17 at 9:17