plot.jmrmlB | R Documentation |
jmrmlB()
Prediction plot from jmrmlB()
## S3 method for class 'jmrmlB'
plot(x, y, ...)
x |
fitted model object |
y |
newdata |
... |
others |
Returns prediction plot for the newdata using the model fitted through jmrmlB()
.
In the example code we use newdata as the data for ID 2 in the PBC2 dataset, it has follow up information till 8.832. Now suppose we want to look at the survival of ID 2 under joint model 1 after time 4 and for joint model 2 after time 9. For that we created the newdata as if the individual is followed till for a time period less than min(4,9).
##
library(JMbayes2)
library(joineRML)
jmrmlBModel<-jmrmlB(dtlong=new_long2[new_long2$id<=400,],
dtsurv=new_surv2[new_surv2$id<=400,],
longm=list(y~x7+visit,y~x7+visit),
survm=list(Surv(time,status)~x1+visit,
Surv(time_2,status_2)~x1+visit),
rd=list(~visit|id,~visit|id),
id='id',
timeVar='visit',
samplesize=200,
BIGdata=TRUE)
t0<-6
ndBIG<-new_long2[new_long2$id==10,]
ndBIG<-ndBIG[ndBIG$visit<t0,]
ndBIG$status<-0
ndBIG$time<-t0
ndBIG$time_2<-10
ndBIG$status_2<-0
plot(jmrmlBModel,ndBIG)
##
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.