Announcement

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

  • Calculate slope in model for a 12 unit change in x

    I have the following model
    Code:
    glm LOS c.time##i.group, f(gam) l(log)
    where
    • LOS is continuous, skewed right
    • time is continuous in months.
    • group is categorical taking on values 1, 2, 3.
    I found the average slope of LOS/month for each center, so I have
    Code:
    margins, dydx(time) at(group=(1,2,3))
    After running this, I found the slopes are too small to be interpretable, so I would like to change the units of time to be years rather than months. Is there a way to do this without creating a new time variable and rerunning the model?

  • #2
    Maybe
    Code:
    display in smcl as text "Slope in years = "  r(table)["b", "time"] * 12 " ± " r(table)["se", "time"] * 12

    Comment


    • #3
      Note in edit: you'll need to do that separately for each level of the group variable. Something like
      Code:
      forvalues group = 1/3 {
          display in smcl as text "Slope in years = "  r(table)["b", "time:`group'._at"] * 12 " ± " r(table)["se", "time:`group'._at"] * 12
      }

      Comment


      • #4
        You can use a contrast of margins. Example here.

        Comment

        Working...
        X