Two senior managers (A and B) are evaluating 15 employees for a new role. A rank of one is assigned to the most suitable employee and so on.
The rankings are as below:
Mgr_A_Ranks: 13, 3, 2, 7, 9, 6, 8, 14, 5, 1, 11, 12, 4, 15, 10
Mgr_B_Ranks: 14, 2, 1, 5, 9, 8, 7, 12, 4, 3, 10, 13, 6, 15, 11
The HR Manager needs to know:
The ranking to be used for the allocation of these employees whenever positions open up
If the rankings done by both managers are consistent or not.
The Spearman’s Rank Correlation \(\rho\) indicates the correlation between two ranked variables (rank of employees by manager A and rank of employees by manager B).
+1 indicates perfect positive relationship
-1 indicates perfect negative relationship
0 indicates no relationship
\(\rho = 1-\frac{6\sum{d^2}}{n(n^2-1)}\) where d is the difference between the ranks being compared.
# Load the ranking of managers A and B
mgr_a_ranks <- c(13, 3, 2, 7, 9, 6, 8, 14,
5, 1, 11, 12, 4, 15, 10)
mgr_b_ranks <- c(14, 2, 1,5,9,8,7,12,4,3,10,13,6,15,11)
corr_res <- cor.test(mgr_a_ranks, mgr_b_ranks, method = 'spearman')
# S denotes the Sum of Square of differences between the rankings
# Correlation Results
corr_res
##
## Spearman's rank correlation rho
##
## data: mgr_a_ranks and mgr_b_ranks
## S = 28, p-value < 2.2e-16
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.95
Reference: Spearkman Coefficient in R https://www.statology.org/spearman-correlation-in-r/