Spearmans Rank Correlation Spearmans Rank Correlation Coefficient Measures

  • Slides: 9
Download presentation
Spearman’s Rank Correlation

Spearman’s Rank Correlation

Spearman’s Rank Correlation Coefficient • Measures correlation between ranks • Corresponds to Pearson product

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 1. Assign ranks, Ri , to the observations of each

Spearman’s Rank Correlation Procedure 1. Assign ranks, Ri , to the observations of each variable separately 2. Calculate differences, di , between each pair of ranks 3. Square differences, di 2, between ranks 4. Sum squared differences for each variable 5. Use shortcut approximation formula

Spearman’s Rank Correlation Example You’re a research assistant for the FBI. You’re investigating the

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. 1 2 3 4 5 Deception 87 63 95 50 43 Pupil size 10 6 11 7 0

Spearman’s Rank Correlation Table Subj. Decep. 1 2 3 4 5 87 63 95

Spearman’s Rank Correlation Table Subj. Decep. 1 2 3 4 5 87 63 95 50 43 R 1 i Pupil 4 3 5 2 1 10 6 11 7 0 2 R 2 i di di 4 2 5 3 1 0 -1 0 Σdi 2= 0 1 0 2

Spearman’s Rank Correlation Solution

Spearman’s Rank Correlation Solution

Correlation using Rstudio 0 Hours, x Test score, y 96 1 85 2 82

Correlation using Rstudio 0 Hours, x Test score, y 96 1 85 2 82 3 74 3 95 5 68 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 5 76 5 84 6 58 7 65 7 75 10 50

Plot X and Y using Rstudio 0 Hours, x Test score, y 96 1

Plot X and Y using Rstudio 0 Hours, x Test score, y 96 1 85 2 82 3 74 3 95 5 68 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 5 76 5 84 6 58 7 65 7 75 10 50

cor(x, y = NULL, use = "everything", method = c("pearson", "kendall", "spearman")) Dec<-c(87, 63,

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")