Skip to contents

The function fits joint model for survival data with two events. It utilizes the JMbayes2 package for obtaining the model parameter estimates.

Usage

jmbB(
  dtlong,
  dtsurv,
  longm,
  survm,
  rd,
  timeVar,
  id,
  samplesize = NULL,
  BIGdata = FALSE,
  niter = 200,
  nburnin = 100,
  nchain = 1
)

Arguments

dtlong

longitudinal data

dtsurv

survival data with two event status along with event time

longm

longitudinal model e.g. list(serBilir~drug * year,serBilir ~ drug * year)

survm

survival model e.g. list(Surv(years,status2)~drug,Surv(time_2,status_2)~drug+age)

rd

random effect component e.g. list(~year|id,~year|id)

timeVar

time variable

id

ID variable

samplesize

samplesize for bigdata

BIGdata

logical argument TRUE or FALSE

niter

number if iteration

nburnin

number of sample to burn

nchain

number of MCMC chain

Value

Estimated model parameters of Joint model with bidirectional survival data

References

Rizopoulos, D., G. Papageorgiou, and P. Miranda Afonso. "JMbayes2: extended joint models for longitudinal and time-to-event data." R package version 0.2-4 (2022).

Bhattacharjee, A., Rajbongshi, B. K., & Vishwakarma, G. K. (2024). jmBIG: enhancing dynamic risk prediction and personalized medicine through joint modeling of longitudinal and survival data in big routinely collected data. BMC Medical Research Methodology, 24(1), 172.

Author

Atanu Bhattacharjee, Bhrigu Kumar Rajbongshi and Gajendra Kumar Vishwakarma

Examples

library(JMbayes2)
#> Loading required package: survival
#> Warning: package 'survival' was built under R version 4.3.3
#> Loading required package: nlme
#> Loading required package: GLMMadaptive
#> Loading required package: splines
st_pbcid<-function(){
  new_pbcid<-pbc2.id
  new_pbcid$time_2<-rexp(n=nrow(pbc2.id),1/10)
  cen_time<-runif(nrow(pbc2.id),min(new_pbcid$time_2),max(new_pbcid$time_2))
  status_2<-ifelse(new_pbcid$time_2<cen_time,1,0)
  new_pbcid$status_2<-status_2
  new_pbcid$time_2<-ifelse(new_pbcid$time_2<cen_time,new_pbcid$time_2,cen_time)
  new_pbcid$time_2<-ifelse(new_pbcid$time_2<new_pbcid$years,new_pbcid$years,new_pbcid$time_2)
  new_pbcid
}
new_pbc2id<-st_pbcid()
pbc2$status_2<-rep(new_pbc2id$status_2,times=data.frame(table(pbc2$id))$Freq)
pbc2$time_2<-rep(new_pbc2id$time_2,times=data.frame(table(pbc2$id))$Freq)
pbc2_new<-pbc2[pbc2$id%in%c(1:100),]
new_pbc2id<-new_pbc2id[new_pbc2id$id%in%c(1:100),]
model_jmbBdirect<-jmbB(dtlong=pbc2_new,dtsurv =new_pbc2id,
                       longm=list(serBilir~drug*year,serBilir~drug*year),
                       survm=list(Surv(years,status2)~drug,Surv(time_2,status_2)~drug+age),
                       rd=list(~year|id,~year|id),
                       id='id',timeVar ='year')
model_jmbBdirect
#> 
#>  Joint model using jmBayes2
#>  ===========================
#>  Summary of first joint model with Event 1: 
#>  -------------------------------------------
#>  Longitudinal process:
#>                    Estimate    SE Zvalue Pvalue
#> (Intercept)           3.568 0.572  6.240  0.000
#> drugD-penicil        -0.660 0.775 -0.852  0.394
#> year                  1.547 0.210  7.357  0.000
#> drugD-penicil:year   -0.102 0.300 -0.339  0.735
#> sigma                 2.554 0.099 25.730  0.000
#> 
#>  Survival process for event1: 
#>       Estimate    SE Zvalue Pvalue
#> SD     -0.242 0.348 -0.695  0.487
#> Mean    0.108 0.108  1.000  0.317
#> 
#>  Random effect covariance matrix :
#>   D[1, 1]   D[2, 1]   D[2, 2] 
#> 17.788705  5.275111  2.453973 
#> 
#>  Summary of second joint model with Event 2: 
#>  -------------------------------------------
#>  Longitudinal process:
#>                    Estimate    SE Zvalue Pvalue
#> (Intercept)           3.464 0.592  5.850  0.000
#> drugD-penicil        -0.451 0.857 -0.527  0.599
#> year                  1.439 0.236  6.111  0.000
#> drugD-penicil:year   -0.139 0.305 -0.455  0.649
#> sigma                 2.563 0.102 25.083  0.000
#> 
#>  Survival process for event2: 
#>                Estimate    SE Zvalue Pvalue
#> drugD-penicil   -0.480 0.247 -1.945  0.052
#> age             -0.003 0.009 -0.385  0.701
#> Mean             0.003 0.003  1.000  0.317
#> 
#>  Random effect covariance matrix :
#>   D[1, 1]   D[2, 1]   D[2, 2] 
#> 19.424056  5.308471  2.154330