Type: | Package |
Title: | Joint Longitudinal and Survival Model for Big Data |
Version: | 0.1.3 |
Maintainer: | Atanu Bhattacharjee <atanustat@gmail.com> |
Description: | Provides analysis tools for big data where the sample size is very large. It offers a suite of functions for fitting and predicting joint models, which allow for the simultaneous analysis of longitudinal and time-to-event data. This statistical methodology is particularly useful in medical research where there is often interest in understanding the relationship between a longitudinal biomarker and a clinical outcome, such as survival or disease progression. This can be particularly useful in a clinical setting where it is important to be able to predict how a patient's health status may change over time. Overall, this package provides a comprehensive set of tools for joint modeling of BIG data obtained as survival and longitudinal outcomes with both Bayesian and non-Bayesian approaches. Its versatility and flexibility make it a valuable resource for researchers in many different fields, particularly in the medical and health sciences. |
Imports: | JMbayes2,joineRML,rstanarm,FastJM,dplyr,nlme,survival,ggplot2 |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
Depends: | R (≥ 2.10) |
RoxygenNote: | 7.3.1 |
NeedsCompilation: | no |
Repository: | CRAN |
Author: | Atanu Bhattacharjee [aut, cre, ctb], Bhrigu Kumar Rajbongshi [aut, ctb], Gajendra K Vishwakarma [aut, ctb] |
Packaged: | 2025-01-19 20:41:40 UTC; atanubhattacharjee |
Date/Publication: | 2025-01-19 21:00:02 UTC |
Bootstrapped CI using FastJM
Description
Bootstrapped CI for predicted survival probability
Usage
cisurvfitJMCS(object)
Arguments
object |
a |
Value
Bootstrap CI for the survival probability and other relevant information for predicted survival plot
Examples
##
library(survival)
library(dplyr)
jmcs1<-jmcsBig(dtlong=data.frame(long2),
dtsurv = data.frame(surv2),
longm=y~ x7+visit,
survm=Surv(time,status)~x1+visit,
rd= ~ visit|id,
samplesize=200,id='id')
mod2<-jmcs1
P2<-survfitJMCS(model<-mod2,ids<-c(5),u<-seq(surv2[surv2$id==5,]$time,
surv2[surv2$id==5,]$time+10,0.2),obs.time='time')
bootci<-cisurvfitJMCS(P2)
print(bootci)
##
Joint model for BIG data using JMbayes2
Description
function for joint model in BIG DATA using JMbayes2
Usage
jmbayesBig(
dtlong,
dtsurv,
longm,
survm,
samplesize = 50,
rd,
timeVar,
nchain = 1,
id,
niter = 2000,
nburnin = 1000
)
Arguments
dtlong |
longitudinal dataset, which contains id,visit time,longitudinal measurements along with various covariates |
dtsurv |
survival dataset corresponding to the longitudinal dataset, with survival status and survival time |
longm |
fixed effect model for longitudinal response |
survm |
survival model |
samplesize |
sample size to divide the Big data |
rd |
random effect model part |
timeVar |
time variable in longitudinal model, included in the longitudinal data |
nchain |
number of chain for MCMC |
id |
name of id column in longitudinal dataset |
niter |
number of iteration for MCMC chain |
nburnin |
number of burnin sample for MCMC chain |
Value
returns a list containing various output which are useful for prediction.
Author(s)
Atanu Bhattacharjee, Bhrigu Kumar Rajbongshi and Gajendra Kumar Vishwakarma
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).
See Also
Examples
##
library(survival)
library(nlme)
library(dplyr)
fit5<-jmbayesBig(dtlong=long2,dtsurv = surv2,longm=y~ x7+visit,survm=Surv(time,status)~x1+visit,
rd= ~ visit|id,timeVar='visit',nchain=1,samplesize=200,id='id')
ydt<-long2%>%filter(id%in%c(900))
cdt<-surv2[,'id']%>%filter(id%in%c(900))
newdata<-full_join(ydt,cdt,by='id')
P2<-predJMbayes(model<-fit5,ids<-c(900),newdata=newdata,process = 'event')
plot(P2$p1[[1]])
##
Joint model for BIG data using FastJM
Description
function for joint model in BIG DATA using FastJM
Usage
jmcsBig(dtlong, dtsurv, longm, survm, samplesize = 50, rd, id)
Arguments
dtlong |
longitudinal dataset, which contains id,visit time,longitudinal measurements along with various covariates |
dtsurv |
survival dataset corresponding to the longitudinal dataset, with survival status and survival time |
longm |
model for longitudinal response |
survm |
survival model |
samplesize |
sample size to divide the Big data |
rd |
random effect part |
id |
name of id column in longitudinal dataset |
Value
returns a list containing various output which are useful for prediction.
Author(s)
Atanu Bhattacharjee, Bhrigu Kumar Rajbongshi and Gajendra Kumar Vishwakarma
References
Li, Shanpeng, et al. "Efficient Algorithms and Implementation of a Semiparametric Joint Model for Longitudinal and Competing Risk Data: With Applications to Massive Biobank Data." Computational and Mathematical Methods in Medicine 2022 (2022).
See Also
jmbayesBig,jmstanBig,joinRMLBig
Examples
##
library(survival)
library(dplyr)
fit2<-jmcsBig(dtlong=data.frame(long2),dtsurv = data.frame(surv2),
longm=y~ x7+visit,survm=Surv(time,status)~x1+visit,rd= ~ visit|id,samplesize=200,id='id')
print(fit2)
##
Joint model for BIG data using rstanarm
Description
function for joint model in BIG DATA using rstanarm
package
Usage
jmstanBig(
dtlong,
dtsurv,
longm,
survm,
samplesize = 50,
time_var,
id,
nchain = 1,
refresh = 2000
)
Arguments
dtlong |
longitudinal dataset, which contains id,visit time,longitudinal measurements along with various covariates |
dtsurv |
survival dataset corresponding to the longitudinal dataset, with survival status and survival time |
longm |
model for longitudinal response |
survm |
survival model |
samplesize |
sample size to divide the Big data |
time_var |
time variable in longitudinal model, included in the longitudinal data |
id |
name of id column in longitudinal dataset |
nchain |
number of chain for MCMC |
refresh |
refresh rate for MCMC chain |
Value
returns a list containing various output which are useful for prediction.
Author(s)
Atanu Bhattacharjee, Bhrigu Kumar Rajbongshi and Gajendra Kumar Vishwakarma
References
Goodrich, B., et al. "rstanarm: Bayesian applied regression modeling via Stan. R package version 2.17. 4." Online< http://mc-stan. org (2018).
See Also
Examples
##
library(survival)
library(dplyr)
fit3<-jmstanBig(dtlong=long2,dtsurv = surv2,longm=y~ x7+visit+(1|id),
survm=Surv(time,status)~x1+visit,samplesize=200,time_var='visit',id='id')
P2<-postTraj(model<-fit3,m<-1,ids<-c(1,2,100))
pp1<-plot(P2$p1[[1]],plot_observed = TRUE)
pp2<-plot(P2$p1[[2]],plot_observed = TRUE)
pp3<-plot(P2$p1[[3]],plot_observed = TRUE)
##
Joint model for BIG data using joineRML
Description
function for joint model in BIG DATA using joineRML
Usage
joinRMLBig(dtlong, dtsurv, longm, survm, samplesize = 50, rd, timeVar, id)
Arguments
dtlong |
longitudinal dataset, which contains id,visit time,longitudinal measurements along with various covariates |
dtsurv |
survival dataset corresponding to the longitudinal dataset, with survival status and survival time |
longm |
model for longitudinal response |
survm |
survival model |
samplesize |
random effect part |
rd |
random effect part |
timeVar |
time variable in longitudinal model, included in the longitudinal data |
id |
name of id column in longitudinal dataset |
Value
returns a list containing various output which are useful for prediction.
Author(s)
Atanu Bhattacharjee, Bhrigu Kumar Rajbongshi and Gajendra Kumar Vishwakarma
References
Hickey, Graeme L., et al. "joineRML: a joint model and software package for time-to-event and multivariate longitudinal outcomes." BMC medical research methodology 18 (2018): 1-14.
See Also
Examples
##
library(survival)
library(dplyr)
fit4<-joinRMLBig(dtlong=long2,dtsurv = surv2,longm=y~ x7+visit,survm=Surv(time,status)~x1+visit,
rd=~ visit|id,timeVar='visit',samplesize=200,id='id')
P2<-predJRML(model<-fit4,ids<-c(10),dtlong=long2,dtsurv=surv2)
pp1<-plot(P2$plong[[1]])
pp1<-plot(P2$psurv[[1]])
##
longitudinal data
Description
A longitudinal dataset with single marker , with different numeric and categorical covariate
Usage
data(long2)
Format
a tibble of 13 columns and 5639 observations,
- id
id value for subjects
- status
survival status
- time
survival time
- y
longitudinal marker
- visit
visit time of longitudinal measurements
- x1,x2,...,x7
different numeric and categorical variable
longitudinal- survival dataset
Description
A longitudinal dataset with single marker , with different numeric and categorical covariate
Usage
data(longsurv)
Format
a tibble of 13 columns and 5639 observations,
- id
id value for subjects
- status
survival status
- time
survival time
- y
longitudinal marker
- visit
visit time of longitudinal measurements
- x1,x2,...,x7
different numeric and categorical variable
Plot for cisurvfitJMCS
object
Description
prediction of survival probability and longitudinal marker using FastJM
for BIG data
Usage
plot_cisurvfitJMCS(object)
Arguments
object |
fitted |
Value
Plot for predicted survival probability
Examples
##
library(survival)
library(dplyr)
jmcs1<-jmcsBig(dtlong=data.frame(long2),
dtsurv = data.frame(surv2),
longm=y~ x7+visit,
survm=Surv(time,status)~x1+visit,
rd= ~ visit|id,
samplesize=200,id='id')
mod2<-jmcs1
P2<-survfitJMCS(model<-mod2,ids<-c(5),u<-seq(surv2[surv2$id==5,]$time,
surv2[surv2$id==5,]$time+10,0.2),obs.time='time')
P3<-cisurvfitJMCS(P2)
plot_cisurvfitJMCS(P3)
##
Prediction using rstanarm
Description
posterior survival probability estimates from rstanarm for BIG data
Usage
postSurvfit(model, ids, ...)
Arguments
model |
fitted model |
ids |
value of id |
... |
other parameter option, see |
Value
list of predicted value for the given id
Examples
##
library(survival)
library(dplyr)
jmstan<-jmstanBig(dtlong=long2,
dtsurv = surv2,
longm=y~ x7+visit+(1|id),
survm=Surv(time,status)~x1+visit,
samplesize=200,
time_var='visit',id='id')
mod1<-jmstan
P2<-postSurvfit(model<-mod1,ids<-c(1,2,210))
pp1<-plot(P2$p1[[1]])
pp1
pp2<-plot(P2$p1[[2]])
pp2
pp3<-plot(P2$p1[[3]])
pp3
##
Prediction using rstanarm
Description
prediction of the posterior trajectory for longitudinal marker while using rstanarm
for Big data
Usage
postTraj(model, m, ids, ...)
Arguments
model |
fitted model object |
m |
m for |
ids |
value of id |
... |
other parameter option, see |
Value
list of predicted values for the given id
Examples
##
library(survival)
library(dplyr)
fit6<-jmstanBig(dtlong=long2,dtsurv = surv2,longm=y~ x7+visit+(1|id),
survm=Surv(time,status)~x1+visit,samplesize=200,time_var='visit',id='id')
P2<-postTraj(model<-fit6,m<-1,ids<-c(1,2,100))
pp1<-plot(P2$p1[[1]],plot_observed = TRUE)
pp2<-plot(P2$p1[[2]],plot_observed = TRUE)
pp3<-plot(P2$p1[[3]],plot_observed = TRUE)
##
Prediction using JMbayes2
Description
prediction of survival probability and longitudinal marker using jmBayes2
for BIG data
Usage
predJMbayes(model, ids, process = "longitudinal", newdata, ...)
Arguments
model |
fitted model object |
ids |
value of id |
process |
see |
newdata |
dataset having covariate information for the ids mentioned above. |
... |
other parameter options, see |
Value
list of predicted value for the given id
Examples
##
library(survival)
library(nlme)
library(dplyr)
jmcs1<-jmbayesBig(dtlong=long2,
dtsurv = surv2 ,
longm=y~ x7+visit,
survm=Surv(time,status)~x1+visit,
rd= ~ visit|id,
timeVar='visit',
nchain=1,
samplesize=200,
id='id')
mod3<-jmcs1
ydt<-long2%>%filter(id%in%c(900))
names(ydt)
cdt<-surv2[,'id']%>%filter(id%in%c(900))
names(cdt)
newdata<-full_join(ydt,cdt,by='id')
P2<-predJMbayes(model<-mod3,ids<-c(900),newdata=newdata,process = 'event')
plot(P2$p1[[1]])
##
Prediction using joineRML
Description
prediction of survival probability and longitudinal marker using joineRML
for BIG data
Usage
predJRML(model, ids, dtlong, dtsurv, ...)
Arguments
model |
fitted model object |
ids |
value of id |
dtlong |
longitudinal data |
dtsurv |
survival data |
... |
other parameter options, see |
Value
list of predicted values for the given id
Examples
##
library(survival)
library(dplyr)
jmcs1<-joinRMLBig(dtlong=long2,
dtsurv = surv2,
longm=y~ x7+visit,
survm=Surv(time,status)~x1+visit,
rd=~ visit|id,
timeVar='visit',
samplesize=200,
id='id')
mod4<-jmcs1
P2<-predJRML(model<-mod4,ids<-c(10),dtlong=long2,dtsurv=surv2)
plot(P2$plong[[1]])
plot(P2$psurv[[1]])
##
print.jmbayesBig
Description
print method for class 'jmbayesBig'
Usage
## S3 method for class 'jmbayesBig'
print(x, ...)
Arguments
x |
fitted object |
... |
others |
Value
prints table containing various parameter estimates, SE, P- value for both survival and longitudinal submodel, if the model is bayesian it includes their credible interval too.
Examples
##
library(survival)
library(dplyr)
#################################
mod3<-jmbayesBig(dtlong=long2,
dtsurv = surv2 ,
longm=y~ x7+visit,
survm=Surv(time,status)~x1+visit,
rd= ~ visit|id,
timeVar='visit',
nchain=1,
samplesize=200,
id='id')
print(mod3)
print.jmcsBig
Description
print method for class 'jmcsBig'
Usage
## S3 method for class 'jmcsBig'
print(x, ...)
Arguments
x |
fitted object |
... |
others |
Value
prints table containing various parameter estimates, SE, P- value for both survival and longitudinal submodel, if the model is bayesian it includes their credible interval too.
Examples
##
library(survival)
library(dplyr)
################################
mod2<-jmcsBig(dtlong=data.frame(long2),
dtsurv = data.frame(surv2),
longm=y~ x7+visit,
survm=Surv(time,status)~x1+visit,
rd= ~ visit|id,
samplesize=200,id='id')
print(mod2)
print.jmstanBig
Description
print method for class 'jmstanBig'
Usage
## S3 method for class 'jmstanBig'
print(x, ...)
Arguments
x |
fitted object |
... |
others |
Value
prints table containing various parameter estimates, SE, P- value for both survival and longitudinal submodel, if the model is bayesian it includes their credible interval too.
Examples
##
library(survival)
library(dplyr)
mod1<-jmstanBig(dtlong=long2,
dtsurv = surv2,
longm=y~ x7+visit+(1|id),
survm=Surv(time,status)~x1+visit,
samplesize=200,
time_var='visit',id='id')
print(mod1)
print.joinRMLBig
Description
print method for class 'joinRMLBig'
Usage
## S3 method for class 'joinRMLBig'
print(x, ...)
Arguments
x |
fitted object |
... |
others |
Value
prints table containing various parameter estimates, SE, P- value for both survival and longitudinal submodel, if the model is bayesian it includes their credible interval too.
Examples
##
library(survival)
library(dplyr)
mod4<-joinRMLBig(dtlong=long2,
dtsurv = surv2,
longm=y~ x7+visit,
survm=Surv(time,status)~x1+visit,
rd=~ visit|id,
timeVar='visit',
samplesize=200,
id='id')
print(mod4)
survival data
Description
A survival dataset related the long2 dataset, with different numeric and categorical covariate
Usage
data(surv2)
Format
a tibble of 13 columns and 1000 observations,
- id
id value for subjects
- status
survival status
- time
survival time
- visit
visit time of longitudinal measurements
- x1,x2,...,x7
different numeric and categorical variable
Prediction using FastJM
Description
prediction of survival probability using FastJM
for BIG data
Usage
survfitJMCS(model, ids, u, method = "GH", obs.time)
Arguments
model |
fitted model object |
ids |
value of id |
u |
see |
method |
options are 'Laplace','GH' |
obs.time |
vector which represents time variable in the longitudinal data |
Value
list of predicted value for the given id along with other information relevant for survival probability confidence plot
Examples
##
library(survival)
library(dplyr)
jmcs1<-jmcsBig(dtlong=data.frame(long2),
dtsurv = data.frame(surv2),
longm=y~ x7+visit,
survm=Surv(time,status)~x1+visit,
rd= ~ visit|id,
samplesize=200,id='id')
mod2<-jmcs1
P2<-survfitJMCS(model<-mod2,ids<-c(5),u<-seq(surv2[surv2$id==5,]$time,
surv2[surv2$id==5,]$time+10,0.2),obs.time='time')
print(P2)
##