Announcement

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

  • Estimating adjusted medians and 95% CI using quantile regression

    Dear StataList:

    I am wishing to estimate age-adjusted median concentrations and 95% CIs of a laboratory measure across categories of participant characteristics (to use in a descriptive table). I have read that quantile regression estimates medians, but I cannot figure out the post-estimation commands to obtain the age-adjusted median concentrations and accompanying 95% CIs by categories of another variable.

    For example, I would like to estimate the age-adjusted median concentration of a laboratory measure across categories of education. I started with the coding:

    qreg [lab measure] [age] [age^2] [categorical education] if pop1==1 [pw=wt], vce(robust) /* I am using data with sample weights */
    predict median if e(sample), xb
    bysort education: centile median if pop1==1

    The values I obtained for the age-adjusted median lab measure and 95% CI across categories of education are vastly different than the crude medians. I suspect my post-estimation commands are incorrect. I also wonder if education should be included in the quantile regression model, or just age and age^2.

    I am grateful for any coding advice you can provide.

    Sincerely,

    Kristen Upson

  • #2
    Hi Kristen
    One question. What do you mean by needing to calculate age-adjusted medians? by and education?
    Do you mean something like: If age structure were the same across education levels, what would be quantiles by education be?
    Perhaps if you have a small example, it would help to understand the final goal of what you are trying to do.
    Best
    Fernando

    Comment


    • #3
      Fernando:

      Thank you for your reply. I am wishing to produce a descriptive table as follows:

      Column 1
      Participant characteristics
      Education
      ___<=High school
      ___Some college
      ___College graduate
      Household income
      ___<$50,000
      ___$50-100,000
      ___>$100,000

      Column 2
      n (%)

      Column 3
      age-adjusted lab measure
      Median (95% CI)

      I have a laboratory measure that decreases sharply with age. The laboratory measure is right-skewed so I am not able to use the mean. I would like to estimate the age-adjusted median lab measure concentration and accompanying 95% CI for each category of a participant characteristic (characteristics such as education, income, smoking status, BMI, etc.).

      Thanks again,

      Kristen
      Last edited by Kristen Upson; 18 Nov 2019, 11:17.

      Comment


      • #4
        Dear Kristen,

        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?

        The method that Mr Conroy describes allows for the calculation of the median of your lab measure while controlling for age (or constraining your cases to age groups).
        But, I agree with Fernando, that some data as an example will make it possible to reply with syntax.

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

        Comment


        • #5
          Dear Eric:

          Thank you for your reply. The idea for obtaining adjusted median concentrations and 95% CI came from the following paper:

          McGreevy KM, Lipsitz SR, Linder JA, Rimm E, Hoel DG. Using median regression to obtain adjusted estimates of central tendency for skewed laboratory and epidemiologic data. Clin Chem. 2009;55:165-9.

          The authors provided SAS code in Appendix 2 (below), but not Stata code:


          " Appendix 2: SAS code for the Saturated Fat in the example.

          proc sort data=nutrients;
          by race;
          run;

          proc quantreg data=nutrients ;
          by race;
          model satfat = age calories bmi / quantile=.5 CovB ;
          run;
          "

          I will try to come up with an example using the auto.dta

          Thank you,

          Kristen

          Comment


          • #6
            Here is an example using auto.dta:

            Say, for example, we were interested in describing the weight-adjusted median price (and accompanying 95% CI) for each category
            of a car characteristic (car characteristics being foreign and binary mpg).

            webuse auto.dta

            ***Binary mpg
            gen mpg_bin=.
            replace mpg_bin=0 if mpg>=12 & mpg<20
            replace mpg_bin=1 if mpg>=20 & mpg<=41

            qreg price
            /*the median price is $5079, 95% CI: 4577-5581 */

            qreg price weight
            predict median, xb
            bysort foreign: centile median
            /* the weight-adjusted median price is $5488, 95% CI: 5363-5720 for Domestic cars
            the weight-adjusted median price is $4344, 95% CI: 4207-4583 for Foreign cars */

            bysort mpg_bin: centile median
            /* the weight-adjusted median price is $5720, 95% CI: 5503-5833 for cars with mpg<20
            the weight-adjusted median price is $4441, 95% CI: 4295-4804 for cars with mpg 20+ */

            Is this the correct approach for estimating the weight-adjusted median price (and 95% CI)
            for each category of a car characteristic?

            Thank you,

            Kristen

            Comment


            • #7
              Hi Kristen
              I read through the article you cited, and based on their explanation, what you are doing seems correct to what the authors explain.
              Here is an example:
              Code:
              webuse cattaneo2, clear
              qreg bweight mmarried mhisp fhisp mage fage order i.msmoke, nolog
              ** Adjusted Medians for Weight by smoking
               margins, at(msmoke=(0 1 2 3)) atmeans
              
              
              ------------------------------------------------------------------------------
                           |            Delta-method
                           |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
              -------------+----------------------------------------------------------------
                       _at |
                        1  |   3423.861   9.813888   348.88   0.000     3404.627    3443.096
                        2  |   3274.669   42.68324    76.72   0.000     3191.011    3358.327
                        3  |   3215.312   33.06152    97.25   0.000     3150.512    3280.111
                        4  |   3193.958   33.49672    95.35   0.000     3128.305     3259.61
              ------------------------------------------------------------------------------
              
              ** Unadjusted Medians
              qreg bweight i.msmoke, nolog
               margins, at(msmoke=(0 1 2 3)) atmeans
              
              ------------------------------------------------------------------------------
                           |            Delta-method
                           |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
              -------------+----------------------------------------------------------------
                       _at |
                        1  |       3430   10.08598   340.08   0.000     3410.232    3449.768
                        2  |       3232   43.83631    73.73   0.000     3146.082    3317.918
                        3  |       3166   33.77023    93.75   0.000     3099.812    3232.188
                        4  |       3175   34.28271    92.61   0.000     3107.807    3242.193
              ------------------------------------------------------------------------------
              HTH
              Fernando

              Comment

              Working...
              X