Statistics#

Correlation Coefficient#

Pearson Correlation Coefficient#

For random variables X and Y (For a population), the Pearson correlation coefficient can be calculated by following formular.

\[r = \frac{cov(X,Y)}{\sigma_X * \sigma_Y} = \frac{E[(X - E[X]) * (Y - E[Y])]}{\sqrt{E[(X - E[X])^2]} * \sqrt{E[(Y - E[Y])^2]}}\]

For a sample, the Pearson correlation coefficient is defined as,

\[r_{xy} = \frac{\sum_{i=1}^{n}(x_i - \overline{x})(y_i - \overline{y})} {\sqrt{\sum_{i=1}^{n}(x_i - \overline{x})^2} * \sqrt{\sum_{i=1}^{n}(y_i - \overline{y})^2}}\]

Reference#

https://en.wikipedia.org/wiki/Pearson_correlation_coefficient

Spearman Rank Correlation Coefficient#

Reference#

https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient