Announcement

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

  • Reporting odds ratio for quantile regression

    In Stata 14 I can report odds ratios for OLS regression by adding
    Code:
    , eform(exp(Coef.))
    But not seeing any such option for quantile regression. Is there any way or user written program that can do this?
    I tried the following, but it shows- invalid eform
    Code:
    webuse auto
    Code:
    sqreg price weight length foreign, q(.25 .5 .75)
    invalid eform

  • #2
    I don't understand what you want to do here. The outcome variable in a quantile regression is a continuous variable, so there is no sense in which you can talk about odds ratios in this context: odds ratios only make sense with dichotomous outcomes.

    Also, using the -eform()- option with -regress- does not give you odds ratios in the first place. It just gives you exponentiated coefficients. If that's what you want, you can do that with:

    Code:
    matrix B = e(b)
    forvalues i = 1/`:colsof B' {
        matrix B[1, `i'] = exp(B[1, `i'])
    }
    
    matrix list B
    Of course, in the particular example you give, many of the coefficients are very large, so that when you try to exponentiate them you get numbers too large to represent in double precision format and they show up as missing values.

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      I don't understand what you want to do here. The outcome variable in a quantile regression is a continuous variable, so there is no sense in which you can talk about odds ratios in this context: odds ratios only make sense with dichotomous outcomes.

      Also, using the -eform()- option with -regress- does not give you odds ratios in the first place. It just gives you exponentiated coefficients. If that's what you want, you can do that with:

      Code:
      matrix B = e(b)
      forvalues i = 1/`:colsof B' {
      matrix B[1, `i'] = exp(B[1, `i'])
      }
      
      matrix list B
      Of course, in the particular example you give, many of the coefficients are very large, so that when you try to exponentiate them you get numbers too large to represent in double precision format and they show up as missing values.
      Thanks Clyde. Unfortunately, I am not comfortable with coefficients and that why I prefer ORs. I did a lot of research and it seems some people support the idea of converting coefs to ORs when the IVs are categorical. This is the case for my original data, the DV is BMI which is continuous, and the IVs are categorical.


      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input byte(age_group income_group) float bmi
      7 3 19.98
      2 3 19.78
      3 3 21.11
      4 3 20.19
      2 2 17.22
      5 2 21.42
      5 1 28.74
      3 3 18.12
      2 2 27.11
      5 1 22.18
      5 1 26.62
      1 1 20.99
      2 2 23.01
      3 1 21.19
      2 3 19.83
      2 2 19.61
      4 3 15.14
      4 3 18.03
      7 4 23.36
      7 3 18.78
      1 3 24.34
      1 4 17.07
      1 3 23.46
      5 4 18.57
      1 4 19.92
      1 4 23.24
      4 3 25.93
      3 2 14.62
      3 4 39.85
      3 4 20.76
      3 2 20.59
      5 3  28.1
      1 3 21.52
      5 3 20.29
      2 3 19.55
      4 4 22.32
      1 4 28.47
      5 3  20.9
      3 4 20.13
      1 4 19.07
      3 3  26.2
      2 3 19.09
      5 4 18.96
      1 4 19.94
      7 5 24.35
      6 3 19.03
      3 3 18.73
      6 2 21.54
      4 2 25.66
      3 3 21.82
      7 2 23.45
      2 2 21.84
      4 4 27.14
      2 4 19.32
      1 4 17.29
      1 4 20.87
      4 4 19.96
      2 4 21.69
      2 5 22.06
      2 4 24.55
      7 3 19.92
      3 3  20.3
      5 4 21.05
      6 4 28.06
      1 4  22.6
      3 4 33.18
      4 4 21.56
      1 1 19.59
      4 4 23.39
      2 4 25.37
      7 3 30.31
      1 3 21.24
      5 2 29.51
      5 4 29.54
      6 4 38.01
      1 4 26.34
      5 3 27.59
      6 3 23.11
      5 5 22.62
      4 2 18.69
      2 1 25.39
      1 4 20.92
      3 5 24.97
      4 5 25.28
      5 5 23.09
      1 5 17.08
      2 5 18.47
      3 5 27.27
      5 5 33.32
      1 5 20.47
      5 4 26.85
      2 4 20.28
      2 4 16.76
      2 4 20.46
      2 4 19.71
      2 4 21.94
      4 5 29.96
      3 5 19.46
      2 4 20.73
      1 4 18.33
      end
      label values age V013
      label def V013 1 "15-19", modify
      label def V013 2 "20-24", modify
      label def V013 3 "25-29", modify
      label def V013 4 "30-34", modify
      label def V013 5 "35-39", modify
      label def V013 6 "40-44", modify
      label def V013 7 "45-49", modify
      label values income V190
      label def V190 1 "poorest", modify
      label def V190 2 "poorer", modify
      label def V190 3 "middle", modify
      label def V190 4 "richer", modify
      label def V190 5 "richest", modify
      After
      Code:
      sqreg bmi i.age i.income
      I tried the code you gave, and I get the following,
      Code:
      . matrix B = e(b)
      
      . 
      . forvalues i = 1/`:colsof B' {
        2. 
      .     matrix B[1, `i'] = exp(B[1, `i'])
        3. 
      . }
      colsof not allowed
      invalid syntax
      r(198);
      
      . 
      . 
      . 
      . matrix list B
      
      B[1,13]
                q50:       q50:       q50:       q50:       q50:       q50:       q50:       q50:
                 1b.         2.         3.         4.         5.         6.         7.        1b.
                age        age        age        age        age        age        age     income
      y1          0  .81999969  1.6299992  2.0900002  2.5999985  2.4699993  2.7099991          0
      
                q50:       q50:       q50:       q50:       q50:
                  2.         3.         4.         5.           
             income     income     income     income      _cons
      y1  .28000069  .27000046  .84000015  2.8900013      19.33
      Anyway, I was finally able to get the ORs in a neat-looking form by using the esttab (ssc inst) output. Thank you for the code.

      Comment


      • #4
        Thanks Clyde. Unfortunately, I am not comfortable with coefficients and that why I prefer ORs. I did a lot of research and it seems some people support the idea of converting coefs to ORs when the IVs are categorical. This is the case for my original data, the DV is BMI which is continuous, and the IVs are categorical.
        This makes no sense. There is no such thing as an odds ratio for a continuous outcome variable. An odds ratio, by definition, expresses the association between two dichotomous variables. When you exponentiate coefficients in a logistic regression (which, by definition, has a dichotomous outcome variable) you get odds ratios.

        But after -regress- or -qreg- etc., you just get exponentiated coefficients--for which there is neither a standard name nor any obvious meaning.

        Comment


        • #5
          What you describe is not an odds ratio. So we should forget about that. Instead, we need to take a step back. The best way to make progress is probably to answer the following two questions:
          • why are you uncomfortable with the coefficients for categorical variables in a quantiles regression?
          • Why do you believe that the exponentiated coefficients in a quantile regression are odds ratios?
          these questions are not intended to put you on the spot, but to help us get the necessary information about you that we need to help you. With that information we can make suggestions on how to interpret your results.
          ---------------------------------
          Maarten L. Buis
          University of Konstanz
          Department of history and sociology
          box 40
          78457 Konstanz
          Germany
          http://www.maartenbuis.nl
          ---------------------------------

          Comment


          • #6
            Maarten Buis and Clyde Schechter, thanks indeed for these important clarifications. I understand that trying to get ORs (exponentials of Coefficients) for continuous outcomes is like swimming against gravity. The reason I never got used to dealing with coefficients is that the variables I work on are almost always categorical and I found ORs pretty straightforward. I was living happily with this until some reviewers started complaining about loss of power in the process, which is starting to make sense to me. This is why I am looking for ways to keep the continuous continuous, without having to change the way interpret them, or at least until I get used to the mainstream. Here are some papers that I was referring to about using ORs for continuous outcomes:

            Odds ratios for a continuous outcome variable without dichotomizing
            https://www.ncbi.nlm.nih.gov/pubmed/15195319

            Methods to convert continuous outcomes into odds ratios of treatment response and numbers needed to treat:
            https://academic.oup.com/ije/article/41/5/1445/711693

            Comment


            • #7
              Thank you for those interesting references.

              So, what you are trying to do is apply one of the estimators that approximates an odds ratio associated with dichotomizing the outcome using some cutoff. I do note that none of the estimators in those articles consists simply of exponentiating the coefficient. The one that seems to come closest to that is from the first reference you gave, by Moser & Coombs, where you must first normalize the coefficient by multiplying by pi/sqrt(3) and then divided by the estimate of the residual standard deviation. That is workable after -regress-, but there is no corresponding parameter calculated by -qreg- (nor -sqreg-).

              Comment

              Working...
              X