0

I tried to fit survival model with several variables violating proportional hazard assumption. I read following vignette thoroughly, but cannot get satisfactory answers for my case. (https://cran.r-project.org/web/packages/survival/vignettes/timedep.pdf).

Qestion 1. Is it okay to do step function for multiple variables, like followings.

vet2 <- survSplit(Surv(time, status) ~ ., data= veteran, cut=c(90, 180),episode= "tgroup", id="id")    
fit <- coxph(Surv(tstart, time, status) ~ trt + prior +
    karno:strata(tgroup) + added_var1:strata(tgroup) + added_var2:strata(tgroup), data=vet2) 

Actually in my case, there are 4 variables that violate the proportional hazard assumption.

Question 2. Tyring to use time-transform ( tt() ) in time-dependent coefficient model, but cannot konw what is the right way to use it. Vignette clearly says tt() is defined like

tt = function(x, t, ...) x * log(t+20)

But, I'm not sure what is correct way to describe relationship between time and variable of my case. (variables violating proportional hazard assumption are certain disease states (ex. diabetes, hypertension..) and type of surgery the patient received)

Look forward help!


Based on comment from IRTFM, I modified my questions. (Specifically, clarified Question 2 and erased Question 3 about default time-transformation.)

JY J
  • 21
  • 3
  • Generally SO expects questions to be focused. Multipart question are suspicious for lack of fucus and that is ther reason for my close vote. might have focus is they accompanied by a [MCVE] and had a natural dependency among them. To my reading (and I am the author of the accepted answer to the linked question) these questions are various distinct misunderstandings of what the tt parameter is used for. It is not a function but a parameter that accepts a function. (I do not see a "step function" in part 1 so lack of clarity might be another reason to close.) – IRTFM Aug 12 '23 at 00:15
  • If you look at the code of `coxph` you see that the default construction of the `tt` functional is `if (!is.null(attr(tform$formula, "specials")$tt)) { coxenv <- new.env(parent = environment(formula)); assign("tt", function(x) x, envir = coxenv); environment(tform$formula) <- coxenv }` – IRTFM Aug 12 '23 at 00:21
  • @IRTFM I just used the example from following vignette section 4.1 Step functions (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:10
  • @IRTFM For Question 2, my point is how can I know the right relationship between time and variables that violate proportional hazard assumption so that I can correct it with tt(). I'm sorry to describe as 'function' so I calrified the expression. – JY J Aug 23 '23 at 15:11

0 Answers0