1
$\begingroup$

I have two variables $(x_i,y_i), \; i=1, \dots 300$ and I would have liked to apply a linear regression on them, but as you can see in the scatterplot below I have a very bad linear trend. enter image description here

As I need to motivate it in an essay, I would like to have a measure of the amount of linearity and I used the Pearson product-moment correlation coefficient, obtaining a value of -0.1559585. But after having tested the normality of the variables with a Shapiro-Wilk test, I have obtained that that the X values are not normally distributed, therefore I cannot use the Pearson coefficient to do that. I read that I could computed Spearman's rank correlation coefficient as the X values don't follow a normal distribution, but this coefficient gives an estimation of the monotonic association between X and Y, while I would like to have a quantification of the linearity between X and Y. Do you know how I can compute a quantity that express this, please?

Thank you very much.

Edit: The qqplot of X is the following

enter image description here

$\endgroup$
  • $\begingroup$ Have you thought about using a Box-Cox transformation? $\endgroup$ – JohnK Dec 5 '15 at 16:44
  • $\begingroup$ Thank you for your advice :) No, but I have just read about it and I tried a Box-Cox transformation on X and I have obtained a better qq plot. I draw an histogram of X and the data now seem gaussian. I have calculated the Pearson coefficient for Y and X transformed, and I have obtained a result of -0.1419915, slightly less than before the transformation. But I don't know how I should interpret this result. What does this tell about the relationship between the original data? Doesn't the transformation change the nature of the data? $\endgroup$ – Helm Dec 5 '15 at 18:47
  • $\begingroup$ Two points. First, it seems that there is some hard limit with many points bunched up at about Y = 28, below which no points are found. If there is such a limit, then your investigation of a linear relation is fraught with difficulty. Second, why do you want "a measure of the amount of linearity" in the first place? Wouldn't a clear description of the relation between X and Y be better, even in transformed scales, regardless of linearity in the original scales? $\endgroup$ – EdM Dec 5 '15 at 19:53
  • $\begingroup$ 1) Yes, the Y values are all of them measure of a quantity that has been recorded if and only if it has a value greater than 26, why does this affects the investigation of the linear relationship? 2) I need to do a lot of regressions (more than 75) on identical datasets aquired at different time scales and I would like to have something - a number - that quantifies if I can apply the regression or not for each dataset(and the only assumption that fails is the linearity), as I cannot show a scatter plot for each dataset. $\endgroup$ – Helm Dec 5 '15 at 20:17
1
$\begingroup$

Why are you even looking at the distribution of $X$? This has no effect on whether or not the relationship between $X$ and $Y$ is linear. But that aside, Pearson's correlation measures the strength of linear association, period. There are no distributional assumptions needed. Just look at a scatterplot of the points (which by the way you haven't shown, you've provided a Q-Q plot) to see if it's linear and report the correlation.

Also, goodness of fit tests will almost always result in a rejection of the null hypothesis with any reasonable sample size, so they shouldn't be relied on too much.

$\endgroup$
  • $\begingroup$ Thank you for your answer. I am looking at the distribution of X because I hava read a lot of references(here an example statstutor.ac.uk/resources/uploaded/pearsons.pdf) that say that before computing Pearson's correlation coefficient, the normality of the variables should be checked. Aren't they correct? Thank you. P.S. Sorry, in my last question I have changed the scatterplot by chance, now it is fixed. $\endgroup$ – Helm Dec 5 '15 at 19:54
  • 1
    $\begingroup$ The person in this article doesn't seem to give any reason for why data have to be bivariate normal in order for a correlation to be meaningful. People justifiably calculate correlations all the time without bothering to check for such an assumption. Just as a counterexample, let $X$ have any non-normal distribution and set $Y = X$. The correlation is one and this tells us quite a lot about the relationship without even mentioning the distributions involved. Statistics aside you can tell just by looking at the plot that $x$ and $y$ don't have much of a relationship here linear or otherwise $\endgroup$ – dsaxton Dec 5 '15 at 20:24
0
$\begingroup$

You might use a Q-Q plot to further assess normality. The X values do not appear too skewed. If the Q-Q plot does not suggest a drastic departure from normality I think $R^2$ (square of the Pearson) is a reasonable measure of linearity. I have never done a Shapiro-Wilk test on real data that did not turn out to be significant so I don't depend on it alone.

$\endgroup$
  • $\begingroup$ Thank you very much for your help. I have posted in the question the QQ plot, it seems not a good normal distribution. Just to be sure, should I fit my points with a linear model and look at the obtained R2? As it is a measure of how much a straight line adapts to the data, can I consider it as a measure of linearity? Thank you very much. $\endgroup$ – Helm Dec 5 '15 at 16:43
  • $\begingroup$ This is the QQ plot of X? It doesn't look that bad to me, maybe a bit skewed but it is not a U-shaped distribution or bi-modal. Try replacing the qqnorm command with qqline and see if the red line does not go straight through most of it. Yes, I would report $R^2$. Even if you transformed X to be normal, you can tell from the scatter plot that there is not much of a trend here so $R^2$ is still likely to be low. Try a box-cox transformation on X and see what happens. $\endgroup$ – Derrick Kaufman Dec 5 '15 at 16:48
  • $\begingroup$ Thank you for your answer. I have attached to the question the qqplot with the qqline. I also tried a box-cox transformation and I reported the result in my answer above to JohnK, but I don't know how to interpret this result. Might you have any suggestion, please? $\endgroup$ – Helm Dec 5 '15 at 18:51
  • $\begingroup$ I'd say after the transformation that makes X more normal and the Pearson coef is still low means there is no linear relationship and you have your answer. Lower by .01 is essentially the same. $\endgroup$ – Derrick Kaufman Dec 5 '15 at 19:08
  • $\begingroup$ But doesn't the transformation change the nature of the data? Why I can rely on a coefficiente computed after a modification of the values of the data? Sorry, I have difficulties to understand this. $\endgroup$ – Helm Dec 5 '15 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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