Announcement

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

  • mkspline2, adjustrcspline, and HR against predictor plot

    Hello, everyone

    My steps:

    1

    mkspline2 rc = predictor1, cubic nknots(3)

    2

    stset time, event(outcome)

    3

    stcox rc* predictor2 predictor3

    4

    adjustrcspline, at(predictor2 = 20 predictor3 = 100) link("log")

    Finally, I got a plot with the Y-axis called E(_t). However, I would like to know the HR against predictor1 plot. Is there anyway to do that? BTW, Cox model does not solve the hazard, instead, it only solves the HR. Therefore, what is the E(_t)? Thank you.

  • #2
    It seems like this.

    Code:
    import excel "~/example.xlsx", firstrow
    
    stset time, failure(outcome)
    
    mkspline ageYs = ageY, cubic nknots(3) displayknots
    
    matrix knots= r(knots)
    
    stcox ageYs* predictor2 predictor3 predictor4
    
    xbrcspline ageYs, values(18(1)90) ref(20) matknots(knots) eform generate(Age HR LCI UCI)
    
    twoway (line LCI UCI Age, sort lc(black black) lp(- -)) (line HR Age, sort lc(black) lp(l)), scheme(sj) ytitle(Hazard ratio) xtitle(Age (years))

    Comment

    Working...
    X