Hello R-inla users,
I am interested in fitting a Cox PH model where there is an interaction term with time. There are two approaches I can use:
1) I can include the interaction term directly in the model
2) use the counting process approach to expand my dataset and then fit the model.
I tried both, but my results don't match with the leukemia dataset in BUGS.
Here is my work for approach 1)
sinla.vet <- inla.surv(data_sim$obs.t, data_sim$fail)
coxinla.vet <- inla(sinla.vet ~ Z + Z*log(obs.t), data = data_sim,
family = "coxph")
Here is my work for approach 2) using the counting process:
#Expand dataset using counting process and survSplit, cut points are unique event times
#Each subject will have observations at all unique time points, until they have an event and are removed from the risk set.
data_sim2 <- survSplit(Surv(data_sim$obs.t, data_sim$fail) ~., data_sim, cut=c(1,2,3,4,5,6,7,8,10,11,12,13,15,16,17,22,23,35))
#Use interval censoring approach where there is a start time and stop time
sinla.vet <- inla.surv(data_sim2$tstart, data_sim2$event, data_sim2$tstop)
coxinla.vet <- inla(sinla.vet ~ Z + Z*log(tstop), data = data_sim2,
family = "coxph")
Thank you. I appreciate any help with this.