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<-unsmoothTP(data.long, s = 100, from = 1, to = 1, method = 'AJ',
trans=trans)
head(res1)
res2<-unsmoothTP(data.long, s = 100, from = 1, to = 1, method = 'LM',
trans=trans)
head(res2)
plot(res1, type='s', xlim=c(0,3000), ylim=c(0.6,1), ylab=c('p11(100,t)'))
lines(res2, type='s', col=2)
legend("topright", legend = c("AJ","LM"), lwd = 0.3, col = c(1,2), cex=0.7,
lty=c(1, 1))
res3<-unsmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'AJ',
trans=trans)
res4<-unsmoothTP(data.long, s = 1000, from = 2, to = 6, method = 'LM',
trans=trans)
plot(res3, type='s', xlim=c(1000,3000), ylim=c(0,0.12), ylab=c('p26(100,t)'))
lines(res4, type='s', col=2)
legend("topright", legend = c("AJ","LM"), lwd = 0.3, col = c(1,2), cex=0.7,
lty=c(1, 1))
Run the code above in your browser using DataLab