Correlation vs Chi Square

Up to now I used correlations to study whether two variables are affected by each other. Now I stumbled over the case that the chi square is doing that too ( http://www.r-tutor.com/elementary-statistics/goodness-fit/chi-squared-test-independence ). Where's the difference respectively which one is more suitable?

In the same context I found https://www.rdocumentation.org/packages/mvoutlier/versions/2.0.9/topics/chisq.plot where "the ordered robust mahalanobis distances of the data against the quantiles of the Chi-squared distribution" is plotted. This is now very confusing as I'm used to apply the Mahalanobis distance to measure similarities. And now it is connected with chi square.

First, in your opening sentence, "affected by" should be "linearly related to". Two variables can be correlated and have not the slightest causal relationship and correlation does not measure all relationships, just linear ones (either on the quantities themselves (Pearson) or their ranks (Spearman)).

So, correlation is about the linear relationship between two variables. Usually, both are continuous (or nearly so) but there are variations for the case where one is dichotomous.

Chi-square is usually about the independence of two variables. Usually, both are categorical. In your first link, the two variables are smoking and exercise and both are measured ordinally - not in terms of number of cigarettes or minutes of exercise, for example. (Incidentally, I would prefer using a test that captured the ordinal nature of the variables, I don't think this is the best example of chi-square).

Your second link is a fairly specialized use of chi-square - it looks like it's an attempt to find multivariate outliers by comparing Mahlanobis distance to what their distribution should be, in the absence of outliers. I would leave that aside while you learn the basics of chi-square.

• Thank you! For a deeper understanding: When two variables are correlated, then there should be a relationship between both or not? Maybe not linear but there must be one? And "independency" is the same as "no relationship", correct?
– Ben
Jan 2 '19 at 15:50
• When two variables are correlated, there is a linear relationship between them. However, you can have a nonlinear relationship where correlation is close to 0. Jan 2 '19 at 16:08

generally, Chi square is a non-parametric test that is used to show association between two qualitative variables (like gender and eye color) ; while correlation (Pearson coefficient) is used to test the correlation between two quantitative variables (like heart rate and blood pressure)

• Thank you! Does that mean I cannot study the relationship between heart rate and blood pressure with chi square?
– Ben
Jan 2 '19 at 15:47
• yes unless you change the data into quantitative Jan 2 '19 at 19:20