In the last lectures I talked about Pearson’s r, which measures the relationship between two continuous (interval or ratio scale) variables.

Spearman Correlation

The Spearman correlation is used when:

1. Measuring the relationship between two ordinal variables.

2. Measuring the relationship between two variables that are related, but not linearly.

Below is an example of some data that is related in a non-linear fashion. For this, we would use the Spearman correlation:

 Figure 1. Let's calculate the Spearman correlation for the following data set:

 Figure 2. To calculate the Spearman correlation, we must first rank the scores:

 Figure 3. We then calculate the correlation using these new ranks:

 Figure 4. We find an r of -1.00, meaning that our data has a negative relationship. As x increases, y decreases. As x decreases, y increases.
{"ft_lang_label":"__label__en","ft_lang_prob":0.87693846,"math_prob":0.99682975,"size":847,"snap":"2023-14-2023-23","text_gpt3_token_len":188,"char_repetition_ratio":0.16488731,"word_repetition_ratio":0.015267176,"special_character_ratio":0.21251476,"punctuation_ratio":0.16049382,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9989886,"pos_list":[0,1,2,3,4,5,6,7,8],"im_url_duplicate_count":[null,1,null,1,null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-04-01T02:22:00Z\",\"WARC-Record-ID\":\"<urn:uuid:1b9be79a-7981-43c0-a34d-15e871de076e>\",\"Content-Length\":\"8026\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:2b7101c5-3cb1-4930-b5b8-6b910be8f681>\",\"WARC-Concurrent-To\":\"<urn:uuid:7782666c-c681-44bc-9e8c-31eb5d81f7ba>\",\"WARC-IP-Address\":\"64.22.68.68\",\"WARC-Target-URI\":\"http://statisticslectures.com/topics/spearman/\",\"WARC-Payload-Digest\":\"sha1:F2UIWKCHSCKZQB2AX5L3TXJD4NZ736RG\",\"WARC-Block-Digest\":\"sha1:HJREPSQGJIDIWYXCQP7KTNPALQNLBDLW\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-14/CC-MAIN-2023-14_segments_1679296949694.55_warc_CC-MAIN-20230401001704-20230401031704-00662.warc.gz\"}"}