If Pearson's correlation is zero does this imply no linear correlation?

I am looking to detect linearity in a dataset. Linearity as in the linearity assumption of linear regression. (There exists a linear relationship between the independent variable, x, and the dependent variable, y. From here)
And I had the idea that if Pearson's correlation can only be applied to linear relationships of variables... couldn't I use Pearson's correlation and if it is near zero, that means the relationship between the two variables is NOT linear?
I know that they could non-linearly correlated or not at all, but that is not what I want to know.

• There can be nonlinear association but no linear "component" to it. Here's ten plots showing association - some indicating clear 'functional' dependence - but all have zero correlation. On the other hand you can also have nonlinear dependence that has nonzero Pearson correlation (which could be regarded as a component of linear dependence) Commented Sep 4, 2022 at 3:52

Your interpretation of Pearson correlation, as measuring the linear relationship between variables, is accurate. However, you need to be a little careful in making the distinction between the true properties of the relationship between variables and an estimator pertaining to those properties. You also need to go further than just referring to the Pearson correlation as "low" without elaborating on how we can tell that "low" is. I will describe how these two issues are dealt with below.

We generally draw a distinction between the true correlation coefficient and the sample correlation, with the latter being an estimate of the former. Pearson correlation is a form of sample correlation and constitutes an estimator of the true correlation. In the code below I use the cor.test function to conduct a hypothesis test for correlation, using the Pearson correlation as the test statistic.

#Generate some mock data (uncorrelated)
X <- rnorm(100)
Y <- rnorm(100)

#Conduct permutation test for zero correlation
set.seed(1)
TEST <- cor.test(x = X, y = Y, alternative = 'two.sided',
method = 'pearson', exact = TRUE, conf.level = 0.95)

#Show results of test
TEST

Pearson's product-moment correlation

data:  X and Y
t = 0.44934, df = 98, p-value = 0.6542
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.1524321  0.2396276
sample estimates:
cor
0.04534364


In this case we have an observed Pearson correlation of $$r = 0.04534$$ and the p-value for the test is $$p = 0.6542$$. Based on this test we do not reject the null hypothesis that the variables are uncorrelated ---i.e., have no linear relationship.

This type of test is what allows us to say that the magnitude of the Pearson correlation is sufficiently "low" that it indicates no linear relationship. Bear in mind that "low" is relative to sample size, so it is not a fixed threshold. With these elaborations in mind, your essential idea is correct.

• Sorry I am not a statistician ... "not rejecting the null hypothesis [...]" means that even if the r is only 0.04534, the variables are still correlated? Commented Sep 4, 2022 at 8:51
• @Flummiboy try to understand the distinction, Ben mentioned at the very beginning. Based on the p value, it can be concluded that the null hypothesis that is the variables are uncorrelated cannot be rejected. The conclusion is based on the sample. You can safely continue taking that the variables are uncorrelated. Commented Sep 4, 2022 at 11:08
• Okay good. But if Pearson's r is low, doesn't that mean, the variables are either non-linearly correlated or not correlated at all? As Pearson's r only captures linear correlation. Commented Sep 4, 2022 at 16:38
– Ben
Commented Sep 4, 2022 at 22:29

Well, yes, if a Pearson correlation is near zero, then by definition with the assumptions of linearity in Pearson correlations there is no linear relationship. As an example, here is a pair of random sampled variables with no relationship with each other:

x.non <- rnorm(n=1000)
y.non <- rnorm(n=1000)


When plotting them and adding a regression line:

plot(x.non,
y.non)
abline(lm(y.non ~ x.non),
col="red")


We get this, a sprinkling of very random data points with no real structure and a flat line, which we don't want.:

I haven't used a seed, but checking the correlation:

cor(x.non,
y.non)


It should be near zero like below:

[1] -0.02072745


Now if you created a conditional relationship where y is dependent on x, you should have a strong relationship, as shown below:

x.cor <- rnorm(n=1000)
y.cor <- x.cor*2 + rnorm(n=1000)

plot(x.cor,
y.cor)
abline(lm(y.cor ~ x.cor),
col="red")


You can quite clearly see the line runs diagonal, not flat. Your data points should also resemble a line like the plot shows, rather than the blob of data points shown earlier with the random data. This is what is meant by linearity: your dots should look as close to a line as possible to hold the linearity assumption. Checking the correlation:

cor(x.cor,
y.cor)


It should be fairly strong:

[1] 0.8892965


Here is a comparison of linearity and the data's corresponding Pearson correlation value for four examples to compare, ranging from no linearity/no correlation to perfect linearity/perfect correlation:

Hope that answers your question and let me know if you need further clarification.