Include an interaction term with time in the Cox PH model

69 views
Skip to first unread message

Nadeesha

unread,
Dec 3, 2021, 12:20:20 AM12/3/21
to R-inla discussion group
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.



Nadeesha

unread,
Dec 3, 2021, 1:05:30 AM12/3/21
to R-inla discussion group
Just a Cox model. Including the interaction term means that PH no longer holds.
Reply all
Reply to author
Forward
0 new messages