Announcement

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

  • Testing equal medians between two variables?

    Dear All, I have the following on two variables
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(id odiff odiff1)
     1 0  0
     2 0  0
     3 0  0
     4 0  0
     5 1  0
     6 0  0
     7 0  0
     8 0  0
     9 0  0
    10 0  0
    11 0  0
    12 0  0
    13 0  0
    14 2  1
    15 2  3
    16 0  0
    17 0  0
    18 0 -1
    19 0 -1
    20 0  0
    21 0  0
    22 1 -1
    23 0  0
    24 1  2
    25 1  0
    26 3  2
    27 0  0
    28 2  2
    29 2  1
    30 1  0
    end
    I think I can use
    Code:
    ttest odiff = odiff1
    to test whether the means of odiff and odiff1 are equal. However, Is there a way to test whether their medians are equal or not? Thanks.
    Ho-Chuan (River) Huang
    Stata 17.0, MP(4)

  • #2
    River:
    perhaps this Stata thread can be helpful: https://www.statalist.org/forums/for...clinical-trial
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      The Wilcoxon-Mann-Whitney test is often cited as doing this, but in general that's not what it does. It's better regarded (slightly non-standard view ahead) as estimating P(X > Y) with a test as a side-effect.

      https://www.stata-journal.com/articl...article=st0253 is worth a look.

      Somers' d is also worth a look. More generally, check out Roger Newson's papers and programs.

      Comment


      • #4
        Originally posted by River Huang View Post
        I can use
        Code:
        ttest odiff = odiff1
        to test whether the means of odiff and odiff1 are equal. However, Is there a way to test whether their medians are equal or not? Thanks.
        I don't understand what it is you're after.

        I can see the paired t-test: you're testing whether the mean difference is zero, that is, whether the mean of individual odiff - odiff1 values is zero.

        But what does it mean "to test whether their medians are equal" when you have paired data?

        From the way that you've stated your question, I assume that you're not interested in the paired t-test's direct analogue: whether the median difference is zero.

        Or are you? If so, then
        Code:
        help signtest
        because it specifically does that.

        Comment


        • #5
          Carlo Lazzaro, @Nick Cox, and @Joseph Coveney: Thank you for all your suggestions. I asked this question for my friend. I will pass the suggestions to her, and see what is exactly in her mind.
          Ho-Chuan (River) Huang
          Stata 17.0, MP(4)

          Comment

          Working...
          X