data("ebmt4")
db_wide <- ebmt4
positions<-list(c(2, 3, 5, 6), c(4, 5, 6), c(4, 5, 6), c(5, 6), c(6), c())
states.names = c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death")
trans<-transTP(positions, states.names)
times.names = c(NA, "rec", "ae","recae", "rel", "srv")
status.names=c(NA, "rec.s", "ae.s", "recae.s", "rel.s", "srv.s")
data.long<-prepTP(data=db_wide, trans, times.names, status.names)
res1<-presmoothTP(data.long, s = 100, from = 1, to = 1,
method = 'PLM', trans=trans)
res2<-presmoothTP(data.long, s = 100, from = 1, to = 1, method = 'cauchit',
trans=trans)
res3<-presmoothTP(data.long, s = 100, from = 1, to = 1, method = 'probit',
trans=trans)
plot(res1, type='s', xlim=c(100,3000), ylim=c(0.6,1), ylab=c('p11(100,t)'))
lines(res2, type='s', col=2)
lines(res3, type='s', col=4)
legend("topright", legend = c("PLM","Cauchit", "Probit"), lwd = 0.3,
col = c(1,2,4), cex=0.7, lty=c(1, 1))
res4<-presmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'PLM',
trans=trans)
res5<-presmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'cauchit',
trans=trans)
res6<-presmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'probit',
trans=trans)
plot(res4, type='s', xlim=c(1000,3000), ylim=c(0,0.12),ylab=c('p26(1000,t)'))
lines(res5, type='s', col=2)
lines(res6, type='s', col=4)
legend("topright", legend = c("PLM","Cauchit", "Probit"), lwd = 0.3,
col = c(1,2,4), cex=0.7, lty=c(1, 1))
Run the code above in your browser using DataLab