Announcement

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

  • Reporting Mann-Whitney / Wilcoxon rank-sum test

    Hi there,

    I am working on my thesis, but got a bit stuck and am hoping someone can help me out...
    First I have to say that I got trained to use SPSS, but for this study I am expected to use STATA. Because the outputs don't match, I am not sure what I am missing and how I should report this.

    So about my study:

    - I have two groups whose scores I want to compare.
    - One group has only positive values and one group only negative. However, I want to compare the levels of these values, so I changed the negative values into positive values and labeled them 0 and 1.
    - First I thought of a t-test, but the assumptions for homogeneity and normality are not met.
    - Therefore, I want to conduct a Mann-Whitney test, which is from what I've understood also called a Wilcoxon rank-sum test?
    - The code I use is:

    ranksum dependentvar, by (independentvar)

    - My output is:


    Two-sample Wilcoxon rank-sum (Mann-Whitney) test

    Independentvar| obs rank sum expected
    -------------+---------------------------------
    0 | 8412 60956067 55250016
    1 | 4723 25314613 31020664
    -------------+---------------------------------
    combined | 13135 86270680 86270680

    unadjusted variance 4.349e+10
    adjustment for ties -1751666.6
    ----------
    adjusted variance 4.349e+10

    Ho: Dependentvar(Independentvar==0) = Dependentvar(Independentvar==1)
    z = 27.362
    Prob > |z| = 0.0000

    - I see that the two groups significantly differ.
    - Now I want to report this. with SPSS I'd say something like: Dependent variable in group 0 (median = ...) was significantly higher than in group 1 (median = ...), U = ..., z = 27.36, p < 0.001, r = ....
    - r I can caulculate by z/squareroot(N) = 27.362/squareroot(13,135) = 0.24
    - I assume I can get the median through summary statistics

    -> But which number is U? In the SPSS output it is just reported, but I have no clue which number this is in STATA... Is this already in my output? Do i find this somewhere else? I have tried to look it up on Google, but can't find much about how to report statistics...

    Can someone please help me out?

    Thanks!

  • #2
    I don't know what SPSS reports as the U statistic; my guess is that you want to use the "porder" option; please read the FAQ to learn how to use CODE blocks so that your submissions are easier to read; for the porder option, see
    Code:
    help ranksum

    Comment


    • #3
      Thank you for your reponse!!

      For porder, I read that that only indicates that chance that when I have a random value, that it will be bigger than the other?
      But all I want to say in my report is that the levels of values significantly differ between the two groups.
      However, I thought that apart from the p-value I am supposed to give more information, such as z and r? And then U or W?
      In SPSS (as it shows in my book at least), the output is (with numbers behind it in a table) something like:

      Code:
       
      Mann-Whitney U
      Wilcoxon W
      Z 
      Asymp. Sig. (2-tailed)
      Exact Sig. [2*(1-tailed Sig.)]
      So it immediately gives U (the first) or W (the second).

      But how am I supposed to report Mann-Whitney? What statistics should I report?

      I know it's a basic question, but I just don't know this and cannot find it anywhere either...

      Comment


      • #4
        Just an additional note, after Rich’s advice.

        Please read this thread:https://www.statalist.org/forums/for...mann-whitney-u



        Hopefully that helps.
        Best regards,

        Marcos

        Comment


        • #5
          Thanks a lot!

          added the following code, just like in that thread:

          Code:
           . scalar define U1 = r(sum_obs) - r(N_1) + 1 / 2
          
          . scalar define U2 = r(N_1) * r(N_2) - U1
          
          . display in smcl as text "Mann-Whitney U = " as result min(U1, U2)
          Mann-Whitney U = -21217780
          However, can I just copy-paste that formula?
          And is -21217780 normal or definitely off and am I making a mistake somewhere?

          Comment


          • #6
            If you changed negative to positive, you reversed the ranks of one group. (Example if the range was -1 to -99, now it's 1 to 99 and the largest and smallest have changed places.) Not correct. Pull back and don't do that.

            Positive and negative values don't affect ranks. With about 13,000 observations even a slight difference between groups will show up as highly significant.

            If one group is all positive and another all negative then (in addition to the point made about sample size) the test will be overwhelming! You can't possibly get a more extreme difference.

            for STATA read Stata throughout (FAQ Advice #18)

            EDIT: Personal opinion: A graph will show immensely more than a test here.
            Last edited by Nick Cox; 11 Jun 2018, 11:16.

            Comment


            • #7
              But don't i already for sure get a significant difference by comparing positive and negative factors?
              That's why I thought it would be best to have them both positive (or negative)?

              The thing is: group 1 only has negative scores (unhealthy group). group 2 only has positive scores (healthy group).
              one group is negative, because later I add up the scores to make a map.
              But first, I want to know if the levels of scores between the two groups differ. It's about impact factors of both groups. So then shouldn't it both be 1-99?

              Comment


              • #8
                The test sounds futile but that doesn't mean you shouldn't do it correctly if you do it at all. If the sign means something you shouldn't throw it away.

                I can't be certain because you aren't giving a clear example of what your data look like.

                But is anyone insisting that you do this test? It sounds like dividing people into tall and short and then testing for the difference you just defined.

                Comment


                • #9
                  Sorry, let me explain it better:

                  I had a set of stores. These were classified into different store types. Every store type has a certain score. Basically there are healthy store types and unhealthy store types.
                  Next, stores were plotted on a map. In a buffer around each store, the score of it's corresponding store type faded.
                  Then for all stores, these buffer scores were added up. This was done over a 100x100 meter grid (one score in each grid).
                  So I have 4723 grids with healthy scores and 8412 grids with unhealthy scores (both inside the same map).
                  Several maps have been made: one with only the healthy scores, one with only the unhealthy scores, and one with the total scores (healthy + unhealthy added).

                  For my study I must conduct a mixed-methods study. However, after making the map, it was said that it's more descriptive rather than statistical testing. So my supervisors believe I should no longer do statistical testing. However, in order to pass I must conduct some sort of statistical analysis... (the report is not graded by my supervisors)
                  That's why I thought it would be a good idea to check if the healthy and unhealthy levels over the grids are similar or not.
                  After all, healthy stores and unhealthy stores could have similar levels over the city (except for one group being positive and the other negative)? Ho: there is no difference in score levels over the city between healthy and unhealthy stores.
                  So nobody is insisting, but I must do sómething and this seemed to make some sense... Do you think it does?

                  Comment


                  • #10
                    The U statistic in #5 indicates something must be really wrong. I don't know about "healthy stores", but I think Nick pointed out clearly to the real issue. For example, in my field, imagine we have two groups that undergo a diet and one group increases blood cholesterol whereas the other decreases. Than, I estimate the difference between the baseline. If I compare the negative values of one group with the positive values of the other, and, what is more, if the first group is classified "healthy" and the second one "unheatlhy", right on account of the very measurements, well, we risk saying the estimation is going to be rather tautological, to say the least.
                    Best regards,

                    Marcos

                    Comment


                    • #11
                      Originally posted by Sophia Rose View Post
                      Thanks a lot!

                      added the following code, just like in that thread:

                      Code:
                       . scalar define U1 = r(sum_obs) - r(N_1) + 1 / 2
                      
                      . scalar define U2 = r(N_1) * r(N_2) - U1
                      
                      . display in smcl as text "Mann-Whitney U = " as result min(U1, U2)
                      Mann-Whitney U = -21217780
                      However, can I just copy-paste that formula?
                      And is -21217780 normal or definitely off and am I making a mistake somewhere?
                      I agree that something is wrong. The range of possible U-values is 0 to n1*n2. See the two examples (Situation 1 and Situation 2) on this web-page, and see the Key Concept box.

                      What is the value of U in your SPSS output?


                      Code:
                      * Code to duplicate the Situation 1 and Situation 2 examples from
                      * http://sphweb.bumc.bu.edu/otlt/mph-modules/bs/bs704_nonparametric/BS704_Nonparametric4.html
                      
                      clear *
                      input byte(situation grp y)
                      1 1 6
                      1 1 7
                      1 1 8
                      1 1 9
                      1 1 10
                      1 2 1
                      1 2 2
                      1 2 3
                      1 2 4
                      1 2 5
                      2 1 2
                      2 1 4
                      2 1 6
                      2 1 8
                      2 1 10
                      2 2 1
                      2 2 3
                      2 2 5
                      2 2 7
                      2 2 9
                      end
                      
                      ranksum y if situation==1, by(grp)
                      scalar define U1 = r(sum_obs)-r(N_1)*(r(N_1)+1)/2
                      scalar define U2 = r(N_1)*r(N_2)-U1
                      display _newline ///
                      in smcl as text "U1 = " as result U1 _newline ///
                      in smcl as text "U2 = " as result U2 _newline ///
                      in smcl as text "U  = " as result min(U1,U2)
                      
                      ranksum y if situation==2, by(grp)
                      scalar define U1 = r(sum_obs)-r(N_1)*(r(N_1)+1)/2
                      scalar define U2 = r(N_1)*r(N_2)-U1
                      display _newline ///
                      in smcl as text "U1 = " as result U1 _newline ///
                      in smcl as text "U2 = " as result U2 _newline ///
                      in smcl as text "U  = " as result min(U1,U2)
                      --
                      Bruce Weaver
                      Email: [email protected]
                      Version: Stata/MP 18.5 (Windows)

                      Comment

                      Working...
                      X