PDF download Download Article PDF download Download Article

Spearman's rank correlation coefficient allows you to identify whether two variables relate in a monotonic function (i.e., that when one number increases, so does the other, or vice versa). To calculate Spearman's rank correlation coefficient, you'll need to rank and compare data sets to find Σd 2 , then plug that value into the standard or simplified version of Spearman's rank correlation coefficient formula. You can also calculate this coefficient using Excel formulas or R commands.

Things You Should Know

  • Calculate the coefficient by finding Σd 2 , then plugging that value into the Spearman's rank correlation coefficient formula.
  • You can also easily calculate this coefficient using Excel.
  • Alternatively, you can find this coefficient using R commands.
Method 1
Method 1 of 3:

By Hand

PDF download Download Article
  1. This will organize the information you need to calculate Spearman's Rank Correlation Coefficient. You will need: [1]
    • 6 Columns, with headers as shown below.
    • As many rows as you have pairs of data.
  2. Advertisement
  3. Give the lowest number a rank of 1, the next lowest number a rank of 2, and so on.
  4. That is, if one is ranked 1 and the other 3 the difference would be 2. (The sign doesn't matter, since the next step is to square this number.) [2]
  5. 9
    Interpret your result. It can vary between -1 and 1.
    • Close to -1 - Negative correlation.
    • Close to 0 - No linear correlation.
    • Close to 1 - Positive correlation.
  6. Advertisement
Method 2
Method 2 of 3:

In Excel

PDF download Download Article
  1. 1
    Create new columns with the ranks of your existing columns. For example, if your data is in Column A2:A11, you want to use the formula "=RANK(A2,A$2:A$11)", and copy it down and across for all your rows and columns. [4]
  2. 2
    Break ties as described in step 3, 4 method 1.
  3. 3
    In a new cell, do a correlation between the two rank columns with something like "=CORREL(C2:C11,D2:D11)". In this case, C and D would correspond to the rank columns. The correlation cell will have your Spearman's Rank Correlation.
  4. Advertisement
Method 3
Method 3 of 3:

Using R

PDF download Download Article
  1. 1
    Get R if you don't already have it. (See http://www.r-project.org .)
  2. 2
    Save your data as a CSV file with the data you want to correlate in the first two columns. You can typically do this through the "Save as" menu.
  3. 3
    Open the R editor. If you are on the terminal, simply run R. From the desktop, you want to click on the R logo.
  4. 4
    Type the commands:
    • d <- read.csv("NAME_OF_YOUR_CSV.csv") and hit enter
    • cor(rank(d[,1]),rank(d[,2])) [5]
  5. Advertisement

Community Q&A

Search
Add New Question
  • Question
    How do I find coefficients?
    Community Answer
    The coefficient is next to the variable. With the example, "4pq," the coefficient is 4.
  • Question
    Is there a correlation between data 1 and data 2?
    Community Answer
    No, there should not be a correlation.
Ask a Question
      Advertisement

      Tips

      • Most data sets should contain at least 5 pairs of data in order to identify a trend (3 were used for the example to make it easier to demonstrate).
      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!
      Advertisement

      Warnings

      • Spearman's rank correlation coefficient will only identify the strength of correlation where the data is consistently increasing or decreasing. If a scatter graph of the data any other trend Spearman's rank will not give an accurate representation of its correlation.
      • This formula is based on the assumption that there are no ties. When there are ties such as in the example one should use the definition: the product moment correlation coefficient based on the ranks.
      Advertisement

      About This Article

      Thanks to all authors for creating a page that has been read 848,230 times.

      Did this article help you?

      Advertisement