0
$\begingroup$

Correlation and Linear Regression

Author:

Lisa Sullivan, PhD

Professor of Biostatistics

Boston University School of Public Health

Says there may be non-linear association which the correlation coefficient does not detect. I disagree with this idea. The Karl Pearson correlation coefficient actually computes the degree of relative changes in two variables which may be constant or varying.

$\endgroup$
2
  • $\begingroup$ What's the question is? $\endgroup$
    – fuwiak
    Apr 4 '20 at 14:22
  • $\begingroup$ Question : do you agree with the assertion that the correlation coefficient doesn't assess nonlinear association, if any. As I understand the Karl Pearson r formula determines the relationship between random variations between two variables and by ignoring fixed consistent relationship, it is based on so called non-linear association. $\endgroup$ Apr 4 '20 at 14:59
2
$\begingroup$

Yes, Dr. Sullivan is right. For example, take a perfect quadratic relationship between X and Y.

Here is some Python code to show nine sample points and calculate their Pearson correlation coefficient. You can skip the code and just look at the results below if you trust me.

import numpy as np
import matplotlib.pyplot as plt
plt.style.use('seaborn')
plt.rcParams["figure.figsize"] = [5, 8]

x = np.arange(-4, 5)
y = x**2  # This is x squared. 

plt.scatter(x, y)

plt.axis('equal')
plt.title('$X = Y^2$', fontsize=20)
plt.xlabel('X', fontsize=14)
plt.ylabel('Y', fontsize=14, rotation=0)
plt.xticks([-4, -2, 0, 2, 4])
plt.yticks([0, 1, 4, 9, 16])

# Calculate the Pearson correlation coefficient:
print('r =', np.corrcoef(x, y)[0, 1])

r = 0.0

X-Y scatterplot

Surely there is a relation between X and Y in this example, and yet the Pearson correlation coefficient is zero.

$\endgroup$
7
  • $\begingroup$ Please indicate the presumed quadratic equation. Am not a software fellow. $\endgroup$ Apr 5 '20 at 4:03
  • $\begingroup$ Just $Y = X^2$. $\endgroup$
    – Arne
    Apr 5 '20 at 11:38
  • $\begingroup$ I improved the plot above to make the quadratic function more obvious. $\endgroup$
    – Arne
    Apr 5 '20 at 14:14
  • $\begingroup$ I think that population correlation (rho) is assumed to be zero when sample correlation (r) is calculated. You have denoted it as r = 0 for the plot. I am trying to say correlation measures the relationship between two variables which denotes either the positive or negative relation or neither. $\endgroup$ Apr 5 '20 at 14:44
  • $\begingroup$ I'm not sure what you mean. You can always calculate $r$, without making any assumptions about $\rho$. Perhaps you are thinking of a hypothesis test, with $\rho = 0$ being the null hypothesis. But the $r = 0$ above would be a purely empirical, descriptive way to quantify the relationship between $X$ and $Y$ in the sample, albeit not a very good one, as the plot shows. $\endgroup$
    – Arne
    Apr 5 '20 at 19:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.