![]() |
|
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2003
Location: Manchester
Posts: 4
|
Is there a formula or function on Excel that allows me to calculate Spearmans Rank Correlation Coefficient?
|
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2003
Location: UK
Posts: 148
|
Not too hot on the old Statistics front, was not my best module at Uni
" Pearson or Spearman correlation? If you choose correlation, choose between standard (Pearson) correlation and nonparametric (Spearman) correlation. Pearson correlation calculations are based on the assumption that both X and Y values are sampled from populations that follow a Gaussian distribution, at least approximately. With large samples, this assumption is not too important. If you don't wish to make the Gaussian assumption, select nonparametric (Spearman) correlation instead. Spearman correlation is based on ranking the two variables, and so makes no assumption about the distribution of the values. " http://www.graphpad.com/instatman/Pe...rrelation_.htm So have a look at the PEARSON function in Excel and see if that can be of any use to you. |
|
|
|
|
|
#3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,207
|
******** ******************** ************************************************************************>
[HtmlMaker 2.32] To see the formula in the cells just click on the cells hyperlink or click the Name box PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR. Formulas are... D3: =IF(ISNUMBER(A3),AVERAGE(RANK(A3,$A$3:$A$14),RANK(A3,$A$3:$A$14)+COUNTIF($A$3:$A$14,A3)-1),"") E3: =IF(ISNUMBER(Q3),AVERAGE(RANK(B3,$B$3:$B$14),RANK(B3,$B$3:$B$14)+COUNTIF($B$3:$B$14,B3)-1),"") F3: =D3-E3 G3: =F3*F3 I2: =COUNT(A3:A14) I3: =SUM(G3:G14) I4: =1-6*I3/(I2^3-I2) L3: =RSQ(E3:E14,D3:D14) L4: =COUNT(D3:D14)-2 L5: =L4*(L3/(1-L3)) L6: =FDIST(L5,1,L4) For method 1, see Siegel (1956, p. 202) plus http://www.zephryus.demon.co.uk/geog.../spear.html#n6 and for Method 2, see... http://udel.edu/~mcdonald/statspearman.html I believe Method 2 is computationally easier and the formulas involved are insensitive to empty cells in X. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
#4 |
|
Board Regular
Join Date: Nov 2007
Posts: 153
|
I use the spearman coefficient alot. I wanted to see if it is possilble for me to get help on creating an UDF that do this for me. I have attached this old thread to show what the full formula looks like.
My data source is a little differenct. I already have the ranked data in Column B and C A1 Column title B1 Rank1 C1 Rank2 A2 XYZ B2 1 C2 3 A3 ABC B3 2 C3 1.5 A4 AAA B4 3 C3 1 etc etc etc So i wanted to create a UDF in column D and be able filldown the udf and have the Correlation number in Column E. This number would be like the result in cell I4 in the example below. This might be to much for excel to handle..Any thoughts? |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Nov 2007
Posts: 153
|
My data example did not post right.
Column A would be the managers Column B is the first ranked data series Column C is the second ranked data series Column D is the UDF Cell E2 would be the result Sorry for the confusion j |
|
|
|
|
|
#6 | |
|
Board Regular
Join Date: Sep 2006
Posts: 685
|
Quote:
http://udel.edu/~mcdonald/statspearman.xls This site also has some information explaining the spreadsheet as well as a few other helpful links when calculating the spearman's rank. http://udel.edu/~mcdonald/statspearman.html Hope that helps.
__________________
Microsoft Windows 7 Microsoft Office 2007 |
|
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Nov 2007
Posts: 153
|
thank you !!!!!
|
|
|
|
|
|
#8 | |
|
Board Regular
Join Date: Sep 2006
Posts: 685
|
You're welcome, and thanks to Aladin that had posted the link earlier in the thread.
Quote:
__________________
Microsoft Windows 7 Microsoft Office 2007 |
|
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Nov 2007
Posts: 153
|
Aladin,
Your example spreadsheet and formulas are very very very helpful!!! I have one question. Spearman coef handles the ties by taking the average ie the 4s in the below example (8.5) Code:
Data Rank Frmla 12.45 1 1.0 10.11 2 2.0 8.32 3 3.0 7.45 4 4.0 6.55 5 5.0 5.1 6 6.0 4.3 7 7.0 4 8 8.5 4 8 8.5 2.1 10 10.0 1.22 11 11.0 Code:
Data 1 Rank Frmla 12.45 1 1.0 10.11 2 2.0 8.32 3 3.0 7.45 4 4.0 6.55 5 5.0 5.1 6 6.0 4 7 8.0 4 7 8.0 4 7 8.0 2.1 10 10.0 1.22 11 11.0 Last edited by jexcel3; Mar 21st, 2008 at 03:46 PM. |
|
|
|
|
|
#10 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,207
|
Quote:
In the first situation, the consecutive rankings for 4 would be: 8 and 9 with average(8,9) yielding 8.5. In the 2nd situtation, the consecutive rankings for 4 would be: 7, 8, and 9, with average(7,8,9) yielding 8. |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|