0

I tried to fit survival model with 4 variables violating proportional hazard assumption. I read following vignette (https://cran.r-project.org/web/packages/survival/vignettes/timedep.pdf) and seared online thoroughly, but could not find similar cases. .

Is it okay to use step function for variables violating proportional hazard assumption? For example,

vet2 <- survSplit(Surv(time, status) ~ ., data= veteran, cut=c(90, 180),
episode= "tgroup", id="id")
fit <- coxph(Surv(tstart, time, status) ~ var1:strata(tgroup) + var2:strata(tgroup) + var3:strata(tgroup) + var4 + var5 + var6, data=vet) 

Or use step function and time-transform function simultaneously? Such as,

fit1<-coxph(Surv(tstart, time, status) ~ var1:strata(timegroup) + var2:strata(timegroup)+ tt(var3) + var4 + var5 + var6, 
                                         data=vet,
                                         tt=function(x, t, ...) x*log(t+20))

looking forward to help!!

JY J
  • 21
  • 3
  • This question would be better suited for stat exchange because it is a statistic question and not a programming question – Mike Aug 02 '23 at 14:09
  • I don't see a "step function" in either formula. – IRTFM Aug 13 '23 at 20:58
  • Thanks for comments. I will ask this question to stat exchange. – JY J Aug 23 '23 at 15:00
  • @IRTFM, I just used the example from following vignette section 4.1 Step functions (https://cran.r-project.org/web/packages/survival/vignettes/timedep.pdf), although I missed survSplit() part at the beginning. I revised the code. Pleast let me know if there is another unclearness. – JY J Aug 23 '23 at 15:02

0 Answers0