+ Reply to Thread
Results 1 to 4 of 4

Thread: How to test using Spearman correlation in R?

  1. #1
    Points: 69, Level: 1
    Level completed: 38%, Points required for next Level: 31

    Posts
    6
    Thanks
    5
    Thanked 0 Times in 0 Posts

    How to test using Spearman correlation in R?




    Given such data
    X-Y
    2-6
    4-9
    6- 3
    8- 12
    10- 15

    When using pearson correlation it will be straight forward, however, when using spearman, should we arrange the data before running the test? Something like

    X- Order X ** Y - Order Y
    2-1 ** 6
    4-2 ** 9
    6- 3 ** 3
    8- 4 ** 12
    10- 5 ** 15

    then we order according to Y
    X- Order X ** Y - Order Y
    6- 3 ** 3 - 1
    2-1 ** 6 - 2
    4-2 ** 9-3
    8- 4 ** 12 - 4
    10- 5 ** 15 - 5

    Then we compare the ranks
    Order X ** Order Y
    3 ** 1
    1 ** 2
    2 ** 3
    4 ** 4
    5 ** 5

  2. #2
    Devorador de queso
    Points: 95,540, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,930
    Thanks
    307
    Thanked 2,629 Times in 2,245 Posts

    Re: How to test using Spearman correlation in R?

    Are you asking about how to do it in general or how to do it in R (the stats programming language)?
    I don't have emotions and sometimes that makes me very sad.

  3. #3
    Points: 69, Level: 1
    Level completed: 38%, Points required for next Level: 31

    Posts
    6
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: How to test using Spearman correlation in R?

    In general I need to order the data, but in R do I need to do it or it will do it by itself?

  4. #4
    Devorador de queso
    Points: 95,540, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,930
    Thanks
    307
    Thanked 2,629 Times in 2,245 Posts

    Re: How to test using Spearman correlation in R?


    R will take care of it for you if you're using cor or cor.test (assuming you add method="spearman" of course).
    I don't have emotions and sometimes that makes me very sad.

  5. The Following User Says Thank You to Dason For This Useful Post:

    John.Thomas (03-07-2014)

+ Reply to Thread

           




Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats