Electron microscopy
 
Spearman Rank Correlation/Spearman's rho/Spearman Correlation
- Python for Integrated Circuits -
- An Online Book -
Python for Integrated Circuits                                                                                   http://www.globalsino.com/ICs/        


Chapter/Index: Introduction | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | Appendix

=================================================================================

Spearman's rank correlation coefficient, often referred to as Spearman's rho or simply the Spearman correlation, is a non-parametric measure of statistical dependence between two variables. It assesses the strength and direction of the monotonic relationship between two variables, which means it is used to determine whether there is a consistent, systematic association between the variables without assuming a linear relationship.

Spearman rank correlation works in the way below:

  1. Ranking: First, you rank the values of each variable separately. This is done by assigning a rank to each observation, with 1 being the smallest value, 2 the next smallest, and so on. If there are tied values (i.e., multiple observations with the same value), you assign them the average rank.

  2. Calculating Differences: Next, you calculate the difference between the ranks for each pair of corresponding observations. This is done for both variables.

  3. Squared Differences: Square the differences calculated in step 2.

  4. Sum of Squared Differences: Sum up all the squared differences from step 3.

  5. Calculate the Spearman Rank Correlation Coefficient: The Spearman correlation coefficient (ρ) is calculated using the following formula:

          Upload Files to Webpages ------------------------------------------------------ [3919a]

Where:

  • ρ (rho) is the Spearman rank correlation coefficient.
  • Σd² is the sum of the squared differences between the ranks of the two variables.
  • n is the number of observations.

Here is how it works:

  1. Rank the values of each variable separately.

  2. Calculate the difference (d) between the ranks for each pair of corresponding observations for both variables.

  3. Square each of the differences (d) calculated in step 2.

  4. Sum up all the squared differences.

  5. Use the formula to compute ρ, which is a measure of the strength and direction of the monotonic relationship between the two variables.

The resulting Spearman correlation coefficient can range from -1 to 1:

  • A positive ρ close to 1 indicates a strong positive monotonic relationship. This means that as one variable increases, the other tends to increase as well.

  • A negative ρ close to -1 indicates a strong negative monotonic relationship. This means that as one variable increases, the other tends to decrease.

  • A ρ close to 0 suggests little to no monotonic relationship between the variables.

Spearman's rank correlation is useful when the assumptions of parametric correlation methods (such as Pearson's correlation) are not met, or when dealing with ordinal or ranked data. It's also less sensitive to outliers than some other correlation measures, making it robust in certain situations.

============================================

The script below compares datasets in FolderOne with datasets in other folders, calculates the Spearman Rank Correlation coefficients to measure their relationships, identifies the best matches, and provides an overall correlation value for each folder. The focus is on finding the most correlated pairs of datasets and assessing the overall correlation between datasets in different folders. Code:
         Upload Files to Webpages
         Upload Files to Webpages
       Input:    
         Upload Files to Webpages
         Upload Files to Webpages
         Upload Files to Webpages
         Upload Files to Webpages
         Upload Files to Webpages
         Upload Files to Webpages
         Upload Files to Webpages
       Output:    
         Upload Files to Webpages

============================================

         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         

 

 

 

 

 



















































 

 

 

 

 

=================================================================================