Description Usage Arguments Details Value Author(s) See Also Examples
This function simlates longitudinal responses and event times from joint models.
Available options are Weibull and log-logistic for the time-to-event submodel,
and LME for the longitudinal process, with a simple linear model for the random-effects component
(i.e., b_0 + b_1 * times
, where b_0 and b_1 are the random intercept and random slope,
respectively).
1 2 | jm.sim(surv.formula, surv.par, surv.model, lme.formula, lme.par, times,
timevar, Data)
|
surv.formula |
a one-sided formula of the form |
surv.par |
a list of the form |
surv.model |
the AFT model to be used to describe the event process. Available options are
|
lme.formula |
a one-sided formula of the form |
lme.par |
a list of the form |
times |
a numeric vector for the time points at which longitudinal measurements are planned to be taken. |
timevar |
the time variable (a character string) of the longitudinal model. For example,
if |
Data |
a data frame containing the baseline covariates |
This function simlates longitudinal responses and event times from joint models.
Available options are Weibull and log-logistic for the time-to-event submodel,
and LME for the longitudinal process, with a simple linear model for the random-effects component
(i.e., b_0 + b_1 * times
, where b_0 and b_1 are the random intercept and random slope,
respectively). The survival function of the time-to-event model is of the form
S_0(\int_0^t exp[-(β_1 z_1 + β_2 z_2 + ... + β_p z_p)-φ(b_0 + b_1 u)]du), and
the longitudinal model is of the form y = α_0 + α_1 x_1 + ... + α_q x_q + α_{q+1} times
+
b_0 + b_1 times
+ ε. The amount of censoring can be controlled by changing the value of
status.rho
.
A list with components:
b:
random effects (a matrix).
long.data:
simulated longitudinal data.
surv.data:
simulated event time data.
Shahedul Khan <khan@math.usask.ca>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | n<-200 # number of subjects
surv.formula<- ~z1+z2
lme.formula<- ~x1+times
# correlation matrix for random-effects
cor.mat<-matrix(c(1,-0.2,-0.2,1),ncol=2,byrow=TRUE)
# sd of random effects
sd<-c(0.5,0.1)
# covariance matrix for random-effects
Sigma<-(sd %*% t(sd))*cor.mat
# parameter values for lme (a named list)
lme.par<-list(alpha=c(10,1,-1),sigma2=0.5,Sigma=Sigma)
# parameter values for the survival model (a named list)
surv.par<-list(beta=c(-0.5,0.5),phi=-0.25,logrho=log(0.25),
logkappa=log(2),status.rho=0.095)
set.seed(54566)
z1<-rbinom(n,1,0.5)
z2<-rnorm(n)
# data with all covariate information
Data<-data.frame(z1=z1,z2=z2,x1=z1)
# time points at which longitudinal measurements are planned to be taken
times<-c(0,1,2,3,4)
# simulate data with Weibull time-to-event model
jmsim.dat<-jm.sim(surv.formula=surv.formula,surv.par=surv.par,
surv.model="weibull",lme.formula=lme.formula,lme.par=lme.par,
times=times,timevar="times",Data=Data)
surv.data<-jmsim.dat$surv.data
long.data<-jmsim.dat$long.data
surv.fit<-coxph(Surv(st,status)~z1+z2,data=surv.data,x=TRUE)
lme.fit<-lme(y~x1+times,random=~times | id,data=long.data)
# Fit the joint model
jmfit.w<-jmreg.aft(surv.fit=surv.fit,lme.fit=lme.fit,
surv.model="weibull",rand.model="simple",timevar="times",
n.chain=2,n.adapt =5000,n.burn=15000,n.iter=50000,n.thin = 5)
sum.w<-jm.summary(jmfit.w,density.plot=TRUE,trace.plot=TRUE)
sum.w
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.