-
Notifications
You must be signed in to change notification settings - Fork 12
Description
First of all, Thank you for this wonderful package.
I would like to try fitting a flexible parametric model relaxing the PH assumption (this was requested by the physician for clinical reasons related to research question).
I have recreated an example using the colon data. In this example, sex is the explanatory variable for which I want to compute the Time varying Hazard Ratio.
library(rstpm2)
colon3<- data.frame(
sex = ifelse(colon$sex == "Female", 0, 1),
status = ifelse(colon$status %in% c("Dead: cancer", "Dead: other"), 1, ifelse(colon$status == "Alive", 0, NA)),
persontime = as.numeric(colon$exit - colon$dx))
I accomplish this using the tvc option inside stpm2.
modvc <- stpm2(Surv(persontime, status) ~ sex, df = 3, tvc = list(sex = 3),
data = colon3)
Then, I tried to plot the Hazard ratio as a function of time.
plot(modvc,
newdata = data.frame(sex = 0),
type = "hr",
var = "sex",
ci = TRUE, rug = FALSE,
las = 1, ylim = c(0.8,1.5), lwd = 2,
main = "Hazard Ratio (TVC)",
xaxt = "n",
xlab = "Time (years)")
axis(1, at = c(seq(0, 365*20, 365)), labels = c(0:20))
From this plot, I would like to display the time-dependent HR, with confidence interval, for some specific values of t (for example, 365 days, 730 days, 5 years, ...).
Is it possible to do this?
Apart from this, do you think such estimates would be easily interpretable or could cause confusion? Are there other ways to compute n-year Hazard ratios with flexible parametric models and time varying coefficients?
Thank you again,
Luigi
