Announcement

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

  • differences in interquartile range

    I would like to analyze differences between interquartile range of two groups, to show that despite medians are similar in one group the dispersion is very low and in the other is higher. I found a stata command named iqreg but I don't know if I can use it for that. Thanks!

  • #2
    That sounds overkill at best and irrelevant at worst. Here is one way to calculate interquartile ranges for two groups. This is code you can run yourself to see how it works.

    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . help egen
    
    . bysort foreign : egen iqr = iqr(mpg)
    
    . bysort foreign : egen median = median(mpg)
    
    . tabdisp foreign, c(median iqr)
    
    ----------------------------------
     Car type |     median         iqr
    ----------+-----------------------
     Domestic |         19         5.5
      Foreign |       24.5           7
    ----------------------------------

    Comment

    Working...
    X