Announcement

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

  • Generating the Interquartile Range with Stata Commands

    In Stata/SE 17.0 is there a way to generate the Interquartile Range from a set of data using a single command? Else is there a method of using strung commands to generate this statistic?

  • #2
    Code:
    help egen
    and see the -iqr()- function.

    Comment


    • #3
      Thank you.

      Comment


      • #4
        See also

        Code:
        . sysuse auto, clear
        (1978 automobile data)
        
        
        . tabstat price-gear_ratio, s(n  p25 p50 p75 iqr) c(s)
        
            Variable |         N       p25       p50       p75       IQR
        -------------+--------------------------------------------------
               price |        74      4195    5006.5      6342      2147
                 mpg |        74        18        20        25         7
               rep78 |        69         3         3         4         1
            headroom |        74       2.5         3       3.5         1
               trunk |        74        10        14        17         7
              weight |        74      2240      3190      3600      1360
              length |        74       170     192.5       204        34
                turn |        74        36        40        43         7
        displacement |        74       119       196       250       131
          gear_ratio |        74      2.73     2.955      3.37  .6399999
        ----------------------------------------------------------------
        The statistics you want are up to you. If you just wanted IQR and nothing else, you could have it.

        Comment

        Working...
        X