Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rank-biserial correlation

    Hello,
    I have an independent binary variable & a dependent ordinal variable. I want to test the correlation between them & found that rank-biserial correlation coefficient will be the most suitable. I can't find it in STATA. Can anyone please tell me how to perform rank-biserial correlation test in STATA version 14.
    Thank you.

  • #2
    This correlation is a special case of Spearman's rank correlation (which is Pearson's correlation computed over the ranks and average ranks of your two variables). It assumes you have a binary variable (call this x) and an at least an ordinal variable (call this y). Then you may compute the rank-biserial correlation as either:

    Code:
    egen y_rank = rank(y)
    corr x y_rank
    spearman x y

    Comment


    • #3
      In my view, ranks are not the most conceptually "nice" way to think about most ordinal variables, which commonly only have a few categories. I'd instead suggest using an explicitly ordinal measure, with Somers' D (-ssc describe somersd-) being my preferred choice here. In the current case, the rank-biserial correlation gives the same result as Somers' D, but I think the theoretical foundation of Somers' D, as well as some of the options offered by the -somersd- community-contributed program, are advantageous. (See Newson, R. 2008. Identity of Somers’ D and the rank biserial correlation coefficient.
      http://www.imperial.ac.uk/nhli/r.new...s/ranksum1.pdf)

      Comment


      • #4
        Leonardo Guizzetti
        Thank you for your reply.
        I tried it but I'm confused which correlation coefficient value should I use ?

        Comment


        • #5
          Mike Lacy

          Thank you for your reply.
          I think I should have both the dependent and independent variables as ordinal variables to perform Somer's D?

          Comment


          • #6
            They are the equivalent, so use whichever you prefer.

            Comment


            • #7
              Re #5: All binary variables are ordinal (e.g., if coded 0/1, individuals in category 1 have "more" of category 1 than they do of category 0.)

              Comment


              • #8
                Mike Lacy
                Re #7: I tried to perform Somer's D test but I couldn't because it needs STATA version 16 and I'm working with version 14.2.
                Would you please explain to me how to perform rank-biserial correlation as an alternative?
                Thank you.

                Comment


                • #9
                  Something is strange here. I started my old copy of Stata version 14.2, and -somersd- works fine for me. Further, the Stata version specification in -somersd- is version 9, at least for the most up to date version of -somersd-, which is 23 April 2006.

                  What did you experience or see that leads you to believe that -somersd- requires version 16? Try the following and post back here what you find:
                  Code:
                  which somersd
                  sysuse auto
                  somersd foreign rep78
                  Last edited by Mike Lacy; 28 May 2022, 21:42. Reason: (-somersd- syntax prescribes the predictor first, then the response variable, so I fixed my mistake.)

                  Comment


                  • #10
                    Code:
                    . which somersd
                    /Users/rich/Library/Application Support/Stata/ado/plus/s/somersd.ado
                    *! Author: Roger Newson
                    *! Date: 15 April 2020

                    Comment


                    • #11
                      Good find by Rich. I wondered if there might be some newer version I wasn't finding.

                      Comment


                      • #12
                        I believe that the problem is that there are versions at each of SSC and SJ; ideally, they would be the same, but ...

                        Comment


                        • #13
                          RE #9: Here is what I get

                          . which somersd
                          c:\ado\plus\s\somersd.ado
                          *! Author: Roger Newson
                          *! Date: 15 April 2020

                          .
                          . sysuse auto
                          (1978 Automobile Data)

                          .
                          . somersd foreign rep78
                          this is version 14.2 of Stata; it cannot run version 16.0 programs
                          You can purchase the latest version of Stata by visiting http://www.stata.com.
                          (error occurred while loading somersd.ado)

                          Comment


                          • #14
                            I don't recall when the -esize- command was added (and I'm too lazy to look it up right now), but it only requires version 13 so if you have it you can use it; see
                            Code:
                            h esize
                            the "pbcorr" option is the relevant one

                            if that doesn't work for you, you might try sending an email to Roger Newson (author of -somersd-) to see if there is a version still available that will run on your version of Stata

                            or, you can use -findit somersd- to find the SJ version and install that (you might need to uninstall the SSC version first)

                            Comment

                            Working...
                            X