Announcement

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

  • mkspline2

    Hi Statalist

    A few coworkers have been using a rather complicated code to create spline plots.
    However, I was told that mkspline2 and adjustrcspline (Maarten Buis: postrcspline) may be a more efficient approach.

    However, I am not able to get the OR on the y-axis, but rather the log odds.
    Is there any way to get this? Whether the regression output show the OR or not, does not matter.
    The code below is from the help file.


    Code:
    ssc install postrcspline
    
    // Example 1 – her viser regressionsoutputtet ikke OR:
              clear all
              sysuse nlsw88, clear
              recode grade 0/5=5
              mkspline2 grades = grade, cubic nknots(3)
              logit never_married grades*
              adjustrcspline
    
    
    
    // Eksempel 2 – her viser regressionsoutput en OR:
              clear all
              sysuse nlsw88, clear
              recode grade 0/5=5
              mkspline2 grades = grade, cubic nknots(3)
              logit never_married grades*, or
              adjustrcspline
    What I seek is a plot similar to this:


  • #2
    In your examples you do not get the log odds but the predicted probability (In a frequentist world the expected value of an indicator variable is a probability). If you prefer odds over probabilities than you can get that with custominvlink() option:

    Code:
    adjustrcspline, custominvlink(exp(xb())) ///
                              ciopts(astyle(ci))       ///
                              ytitle("Odds(never married)")
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Thank you for the response, Maarten.

      Is it possible to select a reference group and then present the odds ratios on the y-axis instead?
      E.g. in the figure example I provided, the HRs are shown for BMI relative to the reference groups of BMI=25.

      Sorry if these are really basic questions. I can see the point of presenting odds - but for the interpretability (and to align with what is currently done at my department) I would like to present the OR.


      Comment


      • #4
        Ok, I see what you mean. No, that is not what adjustrcspline was designed for
        ---------------------------------
        Maarten L. Buis
        University of Konstanz
        Department of history and sociology
        box 40
        78457 Konstanz
        Germany
        http://www.maartenbuis.nl
        ---------------------------------

        Comment


        • #5
          Hi Lau
          Perhaps -f_able- (get it from SSC) can help with that.
          See here: https://journals.sagepub.com/doi/pdf...6867X211000005 for the paper
          and here: https://www.stata.com/meeting/us20/s...ios-Avila1.pdf For a presentation i did on the command.

          Basically, if you could do this using simple interactions, you can do it with any transformation using -f_able-.
          Please, also see helpfile for examples, as the syntax changed a bit.

          F

          Comment


          • #6
            Dear Maarten,

            Thank you very much for your inputs. Presenting the predicted probabilities indeed seems logical.

            In my data (which I cannot provide as they are on a secure server), I observe a decrease in probabilities in the adjusted model compared to the unadjusted model. In the code below is a similar example, where the probability is lower in the adjusted compared with the unadjusted.

            Should the predicted probability in the adjusted analysis be interpreted as the predicted probability when accounting for relevant confounders? - I.e. a more "clean" effect of the exposure on the outcome? (Sorry if this is really basic, but I am not used to interpret adjusted probabilites).


            Code:
            set autotabgraphs on
            
            sysuse nlsw88, clear
            recode grade 0/5=5
            mkspline2 grades = grade, cubic nknots(3)
            logit never_married grades* , or
            adjustrcspline, name(crude, replace)
            
                      
            
            sysuse nlsw88, clear
            recode grade 0/5=5
            mkspline2 grades = grade, cubic nknots(3)
            logit never_married grades* age race , or
            adjustrcspline, name(adjusted, replace)

            Comment


            • #7
              Hi Fernando,

              Thank you for the input. Both the paper and your presentations look very interesting. I will take a look a the package to see if it can help me present my results.

              Comment

              Working...
              X