Announcement

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

  • using stpm2 to plot hazard ratio for a spline continous variable -is this possible as all egs use categorisation

    Dear all,

    I am trying to use P Dickman's stpm2. I'm happy with all the curves I managed to plot.
    However, one pending plot is plotting the Hazard ratio for a continuous variable: experience

    My experience variable, is non-linear therefore I created a spline
    Therefore i have expspl1 expspl2

    I modelled

    Code:
    stpm2 expspl* age gender provider, scale(hazard) df(4) 
    gen t10=10
    
    predict h1, hazard timevar(t10)
    twoway line h1 expspl*, sort 
    
    //Here I just get a horizontal line at 0 for h1 and a horzintal line at .5 for one of the splines 
    
    //I then tried:
    
    //set all covariates at the mean 
    
    gen modelage= 59 //mean of age
    gen modelgender = 0.53 ///mean of gender
    gen modelprovider = 0.58 ///mean of provider 
    
    stpm2 experience modelage modelgender modelprovider, scale(hazard) df(4) 
    predict h1, hazard timevar(t10)
    twoway line h1 experience, sort
    ///this creates a smooth line --- however this is assuming experience is linear, how do I take into consideration the spline variable?


Working...
X