Spearman’s Rank Correlation :1, 1, 3
Spearman’s Rank Correlation Coefficient Measures correlation between ranks Corresponds to Pearson product moment correlation coefficient Values range from –1 to +1 Formula (shortcut) di = ui – vi (difference in ranks of ith observation for samples 1 and 2) n = number of pairs of observations
Spearman’s Rank Correlation Procedure Assign ranks, Ri , to the observations of each variable separately Calculate differences, di , between each pair of ranks Square differences, di2, between ranks Sum squared differences for each variable Use shortcut approximation formula
Spearman’s Rank Correlation Example You’re a research assistant for the FBI. You’re investigating the relationship between a person’s attempts at deception and percent changes in their pupil size. You ask subjects a series of questions, some of which they must answer dishonestly. At the .05 level of significance, what is the correlation coefficient? Subj. Deception Pupil size 1 87 10 2 63 6 3 95 11 4 50 7 5 43 0 112
Spearman’s Rank Correlation Table 2 Subj. Decep. R1i Pupil R2i di di 1 87 10 2 63 6 3 95 11 4 50 7 5 43 4 4 1 -1 1 2 3 2 5 5 2 3 1 1 Σdi2=
Spearman’s Rank Correlation Solution
Correlation using Rstudio Hours, x 1 2 3 5 6 7 10 Test score, y 96 85 82 74 95 68 76 84 58 65 75 50 x<- c(0, 1, 2, 3, 3, 5, 5, 5, 6, 7, 7, 10) y<- c(96, 85, 82, 74, 95, 68, 76, 84, 58, 65, 75, 50) cor(x,y) [1] -0.8312962 cor.test(x,y) data: x and y t = -4.7295, df = 10, p-value = 0.0008048 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.9513335 -0.4922277 sample estimates: cor -0.8312962
Plot X and Y using Rstudio Hours, x 1 2 3 5 6 7 10 Test score, y 96 85 82 74 95 68 76 84 58 65 75 50 x<- c(0, 1, 2, 3, 3, 5, 5, 5, 6, 7, 7, 10) y<- c(96, 85, 82, 74, 95, 68, 76, 84, 58, 65, 75, 50) cor(x,y) [1] -0.8312962 cor.test(x,y) data: x and y t = -4.7295, df = 10, p-value = 0.0008048 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.9513335 -0.4922277 sample estimates: cor -0.8312962
cor(x, y = NULL, use = "everything", method = c("pearson", "kendall", "spearman")) Dec<-c(87,63,95,50,43) Pup<-c(10,6,11,7,0) Data<-data.frame(cbind(Dec, Pup)) cor(Dec, Pup, method="spearman")