I am trying to use mstate package in R, for which I have to use coxph function using strata command. Here is a sample code:
library(mstate)
tmat <- trans.illdeath()
tg <- data.frame(stt=rep(0,6),sts=rep(0,6), illt=c(1,1,6,6,8,9),ills=c(1,0,1,1,0,1),
dt=c(5,1,9,7,8,12),ds=c(1,1,1,1,1,1))
tg$patid <- factor(2:7,levels=1:8,labels=as.character(1:8))
tt <- matrix(c(rep(NA,6),tg$illt,tg$dt),6,3)
st <- matrix(c(rep(NA,6),tg$ills,tg$ds),6,3)
mslong<-msprep(time=tt,status=st,trans=tmat)
models <- coxph(Surv(Tstart, Tstop, status) ~ strata(trans), data=mslong, method='breslow')
I would like to assign an offset term only in the model for transition=3 (i.e. transition from illness to death) so that I can estimate the impact of different treatment effects by changing the offset term. Now, I can assign an offset term for all strata by
mslong$c1<-0
models<-coxph(Surv(Tstart, Tstop, status) ~ strata(trans)+offset(2*c1), data=mslong, method='breslow')
My question is how I can assign an offset term, for example, with coefficient=2 in the above code only for transition = 3 or strata=3? Note that I plan to run the following code from mstate package after. I would really appreciate any help on this.
fit <- msfit(models, trans=tmat)
pt <- probtrans(fit, predt=0)