Math and Code
This post shows some math and code.
Correlations are ubiquitous.
For example, news articles reporting that a research paper found no correlation between X and Y.
Also, it is related to (in)dependence, which plays an important role in linear regression.
This post will explain the Pearson correlation coefficient.
The explanation is mainly based on the book by Hogg et al. (2018).
Let A, B
and C
be discrete random variables defined by respectively f_A(x) = x + 1
, f_B(x) = 0.5x + 3
, and f_C(x) = 5
for the range 1 to 7.
Let D
be the reverse of A
.
The probabilities are chosen such that they are the same for all the values in these random variables.
Show more