ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Finding the Correlation Coefficient Using Pearson Correlation and Spearman Rank Correlation

Updated on July 6, 2018
JR Cuevas profile image

JR has a Bachelor of Science in Civil Engineering and specializes in Structural Engineering. He loves to write anything about education.

Comparing the test performances of three students in a classroom and say, John did the best, Betty did the next best, and Cole did the worst, gives us the ranked form. We cannot say how much better John did than Betty and Cole, but we know how the three performed. If presented with their actual test scores, we would have data in measurement form and could determine precisely how much better John did than Betty and Cole. These two different means of identifying the relationship between sets of data are the Spearman Rank Correlation and the Pearson Correlation. But, how are these two different?

What Is Pearson Correlation?

Pearson Product Moment Correlation is a measure of the correlation between two sets of measured data. It measures the strength of the linear relationship between two sets of data. The formula for calculating the Pearson Product Moment Correlation Coefficient r is:

r = [ n∑XY - ∑X ∑Y ] / √[n∑X2 - (∑X)2] [n∑Y2 - (∑Y)2]

where

r = Pearson correlation coefficient

n = number of paired values of X and Y

∑X = sum of all X values

∑Y = sum of all Y values

∑X2 = sum of all the squares of X

∑Y2 = sum of all the squares of Y

∑(XY) = sum of all the products of X and Y

Pearson r
Interpretation
1
Perfect Linear Relationship
0
No Linear Relationship
-1
Perfect Linear Relationship
0 < r < 1
Positive Correlation
-1 < r < 0
Negative Correlation
Pearson Correlation Coefficient Interpretation

There are different interpretations for different values of Pearson correlation coefficient.

  • If r = 0, the two sets of data has no linear relationship. Usually, there is no relationship between the points in the scatter graph. The dispersed dots in the diagram reveal no conformity at all.
  • If r = 1, the two sets of data signifies a perfect positive correlation. The graph shows a trendline with a positive slope.
  • If r = -1, the two sets of data signifies a perfect negative relationship. The graph shows a trendline with a negative slope.
  • If r is greater than 0 but less than 1, the two sets of data signify a positive linear relationship. The small x values paired with small y values and large x values paired with large y values.
  • If r is between -1 and 0, the two sets of data imply a negative linear relationship. The small x values paired with large y values and large x values paired with small y-values.

Pearson Correlation
Pearson Correlation | Source

What Is Spearman Rank Correlation?

Spearman rank-difference method is a method of estimating the linear correlation between two sets of ranks without any involvement of the complicated computation of the Pearson product moment correlation coefficient. The formula for calculating the Spearman rank correlation coefficient is:

rs = 1 - [ ( 6∑d2 ) / (n(n2 - 1)) ]

where

rs = Spearman rank correlation coefficient

n = number of pairs in ranks

∑d2 = sum of the squared differences between ranks

Spearman r
Interpretation
1
Perfectly Monotone Increasing
0
No Monotone Relationship
-1
Perfectly Monotone Decreasing
close to 1 or -1
Strong Monotone Relationship
close to 0
Weak Monotone Relationship
Spearman Rank Correlation Coefficient Interpretation

There are different interpretations for different values of Spearman rank correlation coefficient.

  • If r = 0, the two sets of data have no monotone relationship. Usually, there is no relationship between the points in the scatter graph. Probably, the relation is non-monotonic. Non-monotonic graphs explicate as x values increase, y values decrease, but suddenly begins to rise again. An example of a non-monotonic diagram is below.
  • If r = 1, the two sets of data signifies a perfectly monotone increasing. Just like in Pearson correlation, the graph shows a trendline with a positive slope.
  • If r = -1, the two sets of data signifies a perfectly monotone decreasing. Just like in Pearson correlation, the graph shows a trendline with a negative slope.
  • If the value of r is close to 1 or -1, the two sets of data signify a strong tendency to have monotone increasing relationship. The trend of the graph can be increasing or decreasing.
  • If the value of r is close to 0, the two sets of data imply an extremely monotone decreasing. Perhaps, it indicates nonexistent.

Spearman Rank Correlation
Spearman Rank Correlation | Source

Similarities and Differences Between Pearson Correlation and Spearman Rank Correlation

Category
Pearson
Spearman
Variables
Measured values
Ranks
Linear relationship between two variables
Applicable
Not applicable
Monotone relationship
Applicable
Applicable
Nonmonotone relationship
Not applicable
Not applicable
Value of correlation coeffcient
-1 < r < 1
-1 < r < 1
r = 1
Perfect positive correlation
Perfectly monotone increasing
r = 0
No correlation
No monotone relationship
r = -1
Perfect negative correlation
Perfectly monotone decreasing
Brief Comparison Between Pearson Correlation and Spearman Correlation

There are few differences between Pearson Correlation and Spearman Rank Correlation when it comes to measuring the correlation between two sets of data. The two differ in the form of data needed to identify the relationship between two sets of data. The Pearson correlation uses data that is in the type of measurements while Spearman rank correlation uses data in a ranking type. Since the Spearman rank correlation only uses the numbers for ranks, examining the occurrence of the linear relationship between two sets of data is not possible. Pearson correlation measures the linear relationship while Spearman rank correlation only analyses the monotonic relationship between two sets of ranking data.

A monotonic relationship is a relationship which only means two things. It is a relationship in which as X increases, Y increases (monotone increasing) and as X increases, Y decreases (monotone decreasing). On the other hand, a linear relationship means the variables X and Y moves in the same direction at a fixed frequency. Linear relationships show a straight line connecting the variables and monotonic relationships show both straight and curvy lines as long as it satisfies the two conditions.

The value of correlation coefficient for both Pearson and Spearman is always in between -1 and +1. A value of +1 implies a perfect positive relationship while a value of -1 signifies perfect decreasing relationship for both. If the value of the correlation coefficient is 0, the sets of data imply no relationship at all.

Example 1: Spearman Rank Correlation

A civil engineering professor has ranked eight students on their "social responsiveness" and "conversational abilities" as part of the university's student council project. Given only the ranking, determine if there is a relationship between the two variables using the Spearman rank correlation method.

Student
Social Rank
Skills Rank
A
3
6
B
6
4
C
1
2
D
8
8
E
2
1
F
5
5
G
7
7
H
4
3
Example on Spearman Rank Correlation

Solution

a. Create a table and solve for the values of d and d2. Remember that d is the absolute value of the difference between the X and Y ranks.

Student
Social Rank
Skills Rank
d
d^2
A
3
6
3
9
B
6
4
2
4
C
1
2
1
1
D
8
8
0
0
E
2
1
1
1
F
5
5
0
0
G
7
7
0
0
H
4
3
1
1
Answer on Spearman Rank Correlation

b. Solve for the summation of d2. Given n = 8, solve the Spearman rank correlation coefficient using the formula provided.

n = 8

∑d2 = 9 + 4 + 1 +1 +1

∑d2 = 16

rs = 1 - [ ( 6∑d2 ) / (n(n2 - 1)) ]

rs = 1 - [ ( 6(16) ) / (8(82 - 1)) ]

rs = 0.81

Final Answer: The value of rs = 0.81 would indicate that the relationship between the social responsiveness and conversational skills among the students is monotone increasing.

Example 2: Pearson Correlation

An English Language Test is part of the entrance exam in Malayan Colleges Laguna. The data shows the test scores (X), and final grades (Y) for five randomly selected examinees who took the entrance exam.

a. Draw a scatter diagram for the data.

b. Compute and interpret the Pearson correlation coefficient r.

Examinee
English Language Test Scores (X)
Final Grade (Y)
A
18
3.00
B
47
2.00
C
36
1.75
D
42
1.50
E
12
5.00
Example on Pearson Correlation

Solution

a. Create a scatter diagram from the given X and Y values. Then, draw the best fit line.

Pearson Correlation
Pearson Correlation | Source

b. Create a table and solve for the values of X2, Y2, and XY.

Examinee
Test Scores (X)
Final Grade (Y)
X^2
Y^2
XY
A
18
3.00
324
9.00
54
B
47
2.00
2209
4.00
94
C
36
1.75
1296
3.0625
63
D
42
1.50
1764
2.25
63
E
12
5.00
144
25.00
60
Total
155
13.25
5737
43.3125
334
Answer on Pearson Correlation

c. Solve for the summation of X, Y, X2, Y2, and XY. Given n = 5, solve the Pearson correlation coefficient using the formula provided.

n = 5

r = [ n∑XY - ∑X ∑Y ] / √[n∑X2 - (∑X)2] [n∑Y2 - (∑Y)2]

r = [ 5(334) - (155)(13.25) ] / √[(5)(5737) - (155)2] [(5)(43.3125)- (13.25)2]

r = -0.88

Final Answer: The correlation coefficient is r = -0.88. To conclude, there is a high negative correlation between test scores and final grade among the examinees of Malayan Colleges Laguna.

Example 3: Spearman Rank Correlation and Pearson Correlation

The president of Malayan Colleges Laguna chose ten students from the college of engineering at random and tests their proficiency in Differential Equations and Numerical Methods. As a process for the Accreditation Program, they want to examine the relationship between the two courses. Using the Pearson Correlation and Spearman Correlation methods, identify if there is any relationship between the proficiency in Differential Equations and Numerical Methods.

a. Draw the scatter diagram for these data

b. Compute the Pearson correlation coefficient r.

c. Compute the Spearman rank correlation coefficient.

Student
Differential Equations (X)
Numerical Methods (Y)
A
13
25
B
15
24
C
16
26
D
12
22
E
12
21
F
13
24
G
13
24
H
9
20
I
8
19
J
9
15
Example on Pearson and Spearman Correlation

Solution

a. Create a scatter diagram from the given X and Y values. Then, draw the best fit line.

Pearson Correlation
Pearson Correlation | Source

b. Create a table and solve for the values of X2, Y2, and XY.

Student
Differential Equations (X)
Numerical Methods (Y)
X^2
Y^2
XY
A
13
25
169
625
325
B
15
24
225
576
360
C
16
26
256
676
416
D
12
22
144
484
264
E
12
21
144
441
252
F
13
24
169
576
312
G
13
24
169
576
312
H
9
20
81
400
180
I
8
19
64
361
152
J
9
15
81
225
135
Total
120
220
1502
4940
2708
Answer on Pearson Correlation

c. Solve for the summation of X, Y, X2, Y2, and XY. Given n = 10, solve the Pearson correlation coefficient using the formula provided.

n = 10

r = [ n∑XY - ∑X ∑Y ] / √[n∑X2 - (∑X)2] [n∑Y2 - (∑Y)2]

r = [ 10(2708) - (120)(220) ] / √[(10)(1502) - (120)2] [(10)(4940)- (220)2]

r = 0.86

To conclude, with r = 0.86, there is a high positive correlation between the two subjects Differential Equations and Numerical Methods.

d. Create a table and solve for the values of d and d2. Remember that d is the absolute value of the difference between the X and Y ranks.

Student
Differential Equations (X)
Numerical Methods (Y)
Rank X
Rank Y
d
d^2
A
13
25
4
2
2
4
B
15
24
2
4
2
4
C
16
26
1
1
0
0
D
12
22
6.5
6
0.5
0.25
E
12
21
6.5
7
0.5
0.25
F
13
24
4
4
0
0
G
13
24
4
4
0
0
H
9
20
8.5
8
0.5
0.25
I
8
19
10
9
1
1
J
9
15
8.5
10
1.5
2.25
Answer on Spearman Rank Correlation

e. Solve for the summation of d2. Given n = 10, solve the Spearman rank correlation coefficient using the formula provided.

n = 10

∑d2 = 4 + 4 + 0.25 +0.25 + 0.25 + 1 + 2.25

∑d2 = 12

rs = 1 - [ ( 6∑d2 ) / (n(n2 - 1)) ]

rs = 1 - [ ( 6(12) ) / (10(102 - 1)) ]

rs = 0.93

The value of rs = 0.93 would indicate that the relationship between Differential Equations and Numerical Methods among the students is monotone increasing.

Final Answer: The Pearson correlation coefficient value is 0.86 while the Spearman rank correlation coefficient value is 0.93. The two answers show that the relationship for the subjects Differential Equations and Numerical Methods is positive and monotone increasing. The results also imply that if a person has a high level of knowledge in Differential Equations, he or she also excels in Numerical Methods.

Did you learn about the comparison of Pearson correlation and Spearman rank correlation?

See results

© 2018 John Ray

Comments

    0 of 8192 characters used
    Post Comment

    • JR Cuevas profile imageAUTHOR

      John Ray 

      7 weeks ago from Philippines

      Hey, Draco. Not really, I just started to love Mathematics when I entered college. Thank you for taking time to look at my article. Have a nice day!

    • Draco986 profile image

      Draco 

      7 weeks ago from United Kingdom

      WOW GREAT article. Very informative and extremely detailed. I assume you are a mathematician?

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://hubpages.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)