# Load the veteran data from the survival package
mydata <- survival::veteran
mydata$celltype <- relevel(mydata$celltype, ref="large")
myformula <- Surv(time, status) ~ karno + celltype
# Fit the time-varying transformation model
fit <- tvTran(myformula, mydata, control=list(resample=TRUE, R=30))
# Plot the time-varying coefficient function between two time points
plotCoef(subset(coef(fit), Time > 15 & Time < 175))Run the code above in your browser using DataLab