correlation analysis
Pearson correlation coefficient
\(\rho_{X, Y}=\frac{\operatorname{cov}(X, Y)}{\sigma_X \sigma_Y}=\frac{E\left[\left(X-\mu_X\right)\left(Y-\mu_Y\right)\right]}{\sigma_X \sigma_Y}\)
So \(\sigma_X\) or \(\sigma_Y\) coudn't be equal to 0.
Spearman’s Rank Correlation Coefficient
For a sample of size n, the n raw scores \(X_{i},Y_{i}\) are converted to ranks R(\(X_{i}\)) R(\(Y_{i}\)) , and \(r_s\) is computed as
\(r_s=\rho_{\mathrm{R}(X), \mathrm{R}(Y)}=\frac{\operatorname{cov}(\mathrm{R}(X), \mathrm{R}(Y))}{\sigma_{\mathrm{R}(X)} \sigma_{\mathrm{R}(Y)}}\)
Only if all n ranks are distinct integers, it can be computed using the popular formula
\(r_s=1-\frac{6 \sum d_i^2}{n\left(n^2-1\right)}\)
Value X | Value Y | X Order | Y Order | X Rank | Y Rank | \(d_i\) | \(d_i^2\) |
---|---|---|---|---|---|---|---|
10 | 12 | 1 | 1 | 1 | 1 | 0 | 0 |
9 | 11 | 2 | 2 | (2+3)/2=2.5 | 2 | 0.5 | 0.25 |
9 | 10 | 3 | 3 | (2+3)/2=2.5 | (3+4)/2=3.5 | -1 | 1 |
8 | 10 | 4 | 4 | 4 | (3+4)/2=3.5 | -0..5 | 0.25 |
\(\sum d_i^2= 1.5\)
\(\rho=1-\frac{6 \sum d_i^2}{n\left(n^2-1\right)}\)
\(\rho = 0.25\)
So, we can see that there must have same number X and Y.