How can assign an offset term in coxph function in R, which later can be used in the “mstate” package?
问题 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 <-