Announcement

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

  • How to calculate effect size for Kruskal-Wallis test?

    Dear all, I am struggling to estimate the effect size for the Kruskal-Wallis test in Stata. I will be grateful if anyone guides me through the procedures. Thank you very much.

  • #2
    Faruque:
    -kwaliis- gives back chi2 and p-value.
    To investigate the effect size, you should better switch to -qreg-:
    Code:
    . use https://www.stata-press.com/data/r16/census
    (1980 Census data by state)
    
    . qreg medage i.region
    Iteration  1:  WLS sum of weighted deviations =  24.856174
    
    Iteration  1: sum of abs. weighted deviations =  24.899998
    Iteration  2: sum of abs. weighted deviations =  24.599998
    Iteration  3: sum of abs. weighted deviations =  24.499998
    
    . qreg medage i.region
    Iteration  1:  WLS sum of weighted deviations =  24.856174
    
    Iteration  1: sum of abs. weighted deviations =  24.899998
    Iteration  2: sum of abs. weighted deviations =  24.599998
    Iteration  3: sum of abs. weighted deviations =  24.499998
    
    Median regression                                   Number of obs =         50
      Raw sum of deviations     29.9 (about 29.700001)
      Min sum of deviations     24.5                    Pseudo R2     =     0.1806
    
    ------------------------------------------------------------------------------
          medage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          region |
        N Cntrl  |       -2.4   .7724916    -3.11   0.003    -3.954945   -.8450546
          South  |  -2.199999    .729936    -3.01   0.004    -3.669284   -.7307139
           West  |  -3.199999   .7596516    -4.21   0.000    -4.729098     -1.6709
                 |
           _cons |       31.8   .5839488    54.46   0.000     30.62457    32.97543
    ------------------------------------------------------------------------------
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      I'd say Kruskal-Wallis was nearer ordinal regression in spirit than quantile regression. What information does it use? The ranks! Mind you, it seems to me that most uses I see of Kruskal-Wallis and similar tests are unduly pessimistic and arise out of a flawed logic still to be found in texts and courses "My data are not normally distributed so I should use non-parametric tests". That is what some of my non-statistician teachers seemed to think in the early 1970s and they were out of touch with best practice even at the time.

      Comment


      • #4
        Dear Carlo, thank you very much for your kind response and I really appreciate your help in resolving the problem. Thanks a lot again.

        Comment


        • #5
          In 2019, someone posted to ResearchGate asking what effect size measure to use in conjunction with the Kruskal-Wallis test. See Savatore Mangiafico's reply posted on 22-Jan-2019. It does not have Stata-specific advice, but may still be helpful to you.
          --
          Bruce Weaver
          Email: [email protected]
          Version: Stata/MP 18.5 (Windows)

          Comment


          • #6
            Thank you nick and bruce for your suggestions.

            Comment


            • #7
              Dear Carlo, to interpret the effect size we have to report the coefficient value, right?
              Last edited by Faruque Sunny; 14 Oct 2021, 00:55.

              Comment


              • #8
                Faruque:
                the best way (for me, at least) to investigate (and self-learning) what you're after is to invoke -predict- after -qreg-, recalculate the fitted values by hand and compare the results of your calculation with -predict-:
                Code:
                . use https://www.stata-press.com/data/r16/census
                (1980 Census data by state)
                
                . qreg medage i.region
                Iteration  1:  WLS sum of weighted deviations =  24.856174
                
                Iteration  1: sum of abs. weighted deviations =  24.899998
                Iteration  2: sum of abs. weighted deviations =  24.599998
                Iteration  3: sum of abs. weighted deviations =  24.499998
                
                Median regression                                   Number of obs =         50
                  Raw sum of deviations     29.9 (about 29.700001)
                  Min sum of deviations     24.5                    Pseudo R2     =     0.1806
                
                ------------------------------------------------------------------------------
                      medage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                      region |
                    N Cntrl  |       -2.4   .7724916    -3.11   0.003    -3.954945   -.8450546
                      South  |  -2.199999    .729936    -3.01   0.004    -3.669284   -.7307139
                       West  |  -3.199999   .7596516    -4.21   0.000    -4.729098     -1.6709
                             |
                       _cons |       31.8   .5839488    54.46   0.000     30.62457    32.97543
                ------------------------------------------------------------------------------
                
                . predict fitted, xb
                
                . list state region medage fitted in 1
                
                     +------------------------------------+
                     | state     region   medage   fitted |
                     |------------------------------------|
                  1. | Alabama   South     29.30     29.6 |
                     +------------------------------------+
                
                . di 31.8 -2.199999
                29.600001
                
                *the median age (medage) is lower (and statistically significantly so) in South vs. NE (the reference category) -region-*
                
                . list state region medage fitted in 2
                
                     +-----------------------------------+
                     | state    region   medage   fitted |
                     |-----------------------------------|
                  2. | Alaska   West      26.10     28.6 |
                     +-----------------------------------+
                
                . di 31.8 -3.199999
                28.600001
                
                *the median age (medage) is lower (and statistically significantly so) in West vs. NE -region-*
                . list state region medage fitted in 13
                
                     +--------------------------------------+
                     | state      region    medage   fitted |
                     |--------------------------------------|
                 13. | Illinois   N Cntrl    29.90     29.4 |
                     +--------------------------------------+
                
                . di 31.8 -2.4
                29.4
                *the median age (medage) is lower (and statistically significantly so) in N Cntrl vs. NE -region-*
                .
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment


                • #9
                  Dear Carlo, thank you very much for your guidance. Due to a lack of knowledge, I cannot understand how to perform the test and interpret the results. But I am eager to learn and due to people like you, nick and bruce – we can learn a lot. Thank you so much again.

                  Comment


                  • #10
                    Faruque:
                    it's easier done than said.
                    It's just a matter of practising !
                    Kind regards,
                    Carlo
                    (Stata 19.0)

                    Comment

                    Working...
                    X