Displaying 1 result from an estimated 1 matches for "trmt".
Did you mean:
rmt
2011 Jul 15
1
Plotting survival curves from a Cox model with time dependent covariates
...a clinical trial with two treatments and a time to
event outcome. I am trying to fit a Cox model with a time dependent
treatment effect and then plot the predicted survival curve for one
treatment (or both).
library(survival)
test <-
list(time=runif(100,0,10),event=sample(0:1,100,replace=T),trmt=sample(0:1,100,replace=T))
model1 <- coxph(Surv(time, event) ~ tt(trmt), data=test, tt=function(x,
t, ...) pspline(x + t))
newdat1 <- data.frame(trmt=1,time=list(0,1,2,3,4,5))
plot(survfit(model1,newdata=newdat1,individual=T), xlab = "Years",
ylab="Survival")
Where I th...