Announcement

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

  • Calculating adjusted odds ratios for two variables with a single reference category

    I would like to know how I can calculate adjusted Odds Ratios with 95% CI for each (age and socioeconomic status) stratum with a single reference category? Instead of having one reference category for age and one reference category for socioeconomic status, which is the output of binary logistic regression.

    Further, I would like to test the interaction for these two variables, while adjusting for confounders.

    The outcome of interest is a binary variable (yes/no).

    Presenting in a table like this:
    Less than 19 years 20-29 years More than 30 years
    Socioeconomic status High 1 (reference)
    Medium
    low

  • #2
    You can make logit output those odds ratios, see this Stata tip: https://www.stata-journal.com/articl...article=st0250

    Here is an example that applies these techniques:

    Code:
    // open example data
    sysuse nlsw88, clear
    
    // prepare the data
    
    gen byte occat = cond(occupation < 3, 1,                    ///
                     cond(inlist(occupation,5, 6, 8, 9), 2, 3)) ///
                     if !missing(occupation)
    label variable occat "occupational category"
    label define occat 1 "white collar" ///
                       2 "skilled"      ///
                       3 "unskilled"
    label value occat occat
    gen byte urban = c_city + smsa
    label define urban 2 "central city" ///
                       1 "suburban"     ///
                       0 "rural"
    label value urban urban
    label variable urban "urbanicity"
    
    // the model with the adjusted odds ratios you are looking for
    logit union ibn.urban ib1.occat#i.urban grade i.race i.south, or nocons
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Thanks for giving your suggestions. I have run the commands in the example and for my data. However, by considering one single reference group here, for example, central city and white-collar, I do not know from such a presentation whether the subgroup (white-collar suburban) or the subgroup (white-collar rural) is at higher risk for the outcome. Could you give me your suggestions on that?

      Comment


      • #4
        Code:
        logit union ibn.occat#ibn.urban grade i.race i.south, or nocons
        Will give you the odds (no longer odds ratio) of being a union member for each subgroup for someone with 0 years of education, white from the non-south. In this case I would probably center grade at say 12, to give these odds for someone who finished highschool.
        ---------------------------------
        Maarten L. Buis
        University of Konstanz
        Department of history and sociology
        box 40
        78457 Konstanz
        Germany
        http://www.maartenbuis.nl
        ---------------------------------

        Comment


        • #5
          Thanks for the suggestion. If we consider the example above I need to have adjusted odds ratios when we have a single reference group of ( white collar#central city). Because I want to calculate biological interactions and for that, it is recommended to have one single reference group.

          Comment


          • #6
            OK, I think I finally understand what you want. I would not consider that the most intuitive way of discussing an interaction, but tastes differ.

            Code:
            // open example data
            sysuse nlsw88, clear
            
            // prepare the data
            
            gen byte occat = cond(occupation < 3, 1,                    ///
                             cond(inlist(occupation,5, 6, 8, 9), 2, 3)) ///
                             if !missing(occupation)
            label variable occat "occupational category"
            label define occat 1 "white collar" ///
                               2 "skilled"      ///
                               3 "unskilled"
            label value occat occat
            gen byte urban = c_city + smsa
            label define urban 2 "central city" ///
                               1 "suburban"     ///
                               0 "rural"
            label value urban urban
            label variable urban "urbanicity"
            
            // combine occupation and urbanicity into one variable
            egen inter = group(urban occat), label      // <-- new
            
            // the model with the adjusted odds ratios you are looking for
            // you requested central city, white collar to be the referece
            // which has value 7 on the variable inter, so that is what ib7 means
            logit union ib7.inter grade i.race i.south, or base     // <-- new
            Notice, that all the models I suggested are the exact same model; they are not approximations of one another, they mathematically exactly the same. The only difference is the way they are displayed. As long as you correctly interpret the results all these models are equally correct (or equally wrong, if there is some other problem with your model)
            ---------------------------------
            Maarten L. Buis
            University of Konstanz
            Department of history and sociology
            box 40
            78457 Konstanz
            Germany
            http://www.maartenbuis.nl
            ---------------------------------

            Comment


            • #7
              Thanks a lot. This was exactly what I was looking for, from the information, which uses a common reference group, we could know that the ordering of risk across subgroups. Is it possible to plot the final model by having the adjusted odds ratio on the y-axis?
              Last edited by Zahra Roustaei; 29 May 2020, 05:33.

              Comment


              • #8
                you could look at coefplot , type in Stata search coefplot
                ---------------------------------
                Maarten L. Buis
                University of Konstanz
                Department of history and sociology
                box 40
                78457 Konstanz
                Germany
                http://www.maartenbuis.nl
                ---------------------------------

                Comment

                Working...
                X