Announcement

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

  • Confidence intervals of medians by group

    Dear all,

    I want to find out the confidence intervals of the median earnings by different years.

    Unfortunately, the centile command has no by-option so that something like:

    Code:
    centile earnings, by (year)
    does not work.

    I also thought about the or ci command, but as far as I'm aware it does not allow to calculate the confidence interval of medians.

    Any help would be appreciated.


  • #2
    Toni:
    I do hope that what follows may be helpful:
    Code:
    . use "C:\Program Files (x86)\Stata15\ado\base\a\auto.dta"
    (1978 Automobile Data)
    
    . bysort foreign: centile price, centile(10(10)90)
    
    ------------------------------------------------------------------------------------------------------------------------
    -> foreign = Domestic
    
                                                           -- Binom. Interp. --
        Variable |       Obs  Percentile    Centile        [95% Conf. Interval]
    -------------+-------------------------------------------------------------
           price |        52         10      3866.8        3297.907    4087.846
                 |                   20      4092.2         3890.42    4418.487
                 |                   30      4369.6         4077.78    4618.593
                 |                   40      4506.4        4190.473    4905.179
                 |                   50      4782.5        4464.559    5316.421
                 |                   60      5185.6         4729.55     6043.89
                 |                   70      5806.8        5118.746     8016.34
                 |                   80      7022.4        5789.575     11442.4
                 |                   90     11463.4        7365.857    14692.03
    
    ------------------------------------------------------------------------------------------------------------------------
    -> foreign = Foreign
    
                                                           -- Binom. Interp. --
        Variable |       Obs  Percentile    Centile        [95% Conf. Interval]
    -------------+-------------------------------------------------------------
           price |        22         10      3827.1            3748    4467.642*
                 |                   20      4175.6         3769.71    5027.452
                 |                   30        4580        3904.144      5763.5
                 |                   40      5142.6        4270.964    6194.331
                 |                   50        5759         4582.73    6870.205
                 |                   60        6163        5112.408    8258.839
                 |                   70        6879          5754.5    9730.885
                 |                   80      8753.4        6237.906    12557.97
                 |                   90       11317        7292.772       12990*
    
    * Lower (upper) confidence limit held at minimum (maximum) of sample
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Where are you taking this information that you are reporting from ? The -help centile- says " by and statsby are allowed; see prefix."

      Here:

      Code:
      . sysuse auto, clear
      (1978 Automobile Data)
      
      . bysort foreign: centile price, cen(50)
      
      ------------------------------------------------------------------------------------------------------------------
      -> foreign = Domestic
      
                                                             -- Binom. Interp. --
          Variable |       Obs  Percentile    Centile        [95% Conf. Interval]
      -------------+-------------------------------------------------------------
             price |        52         50      4782.5        4464.559    5316.421
      
      ------------------------------------------------------------------------------------------------------------------
      -> foreign = Foreign
      
                                                             -- Binom. Interp. --
          Variable |       Obs  Percentile    Centile        [95% Conf. Interval]
      -------------+-------------------------------------------------------------
             price |        22         50        5759         4582.73    6870.205
      
      .

      Comment


      • #4
        Thank you so much for your help and sorry for misreading the help-file.

        Comment


        • #5
          Dear Toni,

          Possibly, this paper offers good advice to compare and examine median values between group categories:

          The Stata Journal 2012 12 2 162-190 RM Conroy What hypotheses do nonparametric two-group tests actually test?

          Best,
          Eric
          http://publicationslist.org/eric.melse

          Comment


          • #6
            ericmelse Thank you for sharing the article in #5. Quite insightful!
            Best regards,

            Marcos

            Comment

            Working...
            X