Description Usage Arguments Details Value Note Author(s) References See Also Examples
Fits shared parameter joint models for longitudinal and survival outcomes under a Bayesian approach.
1 2 3 4 5 6  jointModelBayes(lmeObject, survObject, timeVar,
param = c("tdvalue", "tdextra", "tdboth", "sharedbetasRE", "sharedRE"),
extraForm = NULL, baseHaz = c("Psplines", "regressionsplines"),
transFun = NULL, densLong = NULL, lag = 0, df.RE = NULL,
estimateWeightFun = FALSE, weightFun = NULL, init = NULL,
priors = NULL, scales = NULL, control = list(), ...)

lmeObject 
an object of class 'lme' fitted by function 
survObject 
an object of class 'coxph' fitted by function 
timeVar 
a character string indicating the time variable in the mixed effects model. 
param 
a character string specifying the type of association structure between the longitudinal and survival processes. See Details. 
extraForm 
a list with components 
baseHaz 
a character string specifying the type of the baseline hazard function. See Details. 
transFun 
a function or a named list with elements 
densLong 
a function with arguments 
lag 
a numeric scalar denoting a lag effect in the timedependent covariate represented by the mixed model; default is 0. 
df.RE 
a numeric scalar denoting the number of degrees of freedom for the Student'st randomeffects distribution. If 
estimateWeightFun 
logical; experimental, not in use yet. 
weightFun 
a weight function; experimental, not in use yet. 
init 
a named list of userspecified initial values:
When this list of initial values does not contain some of these components or contains components not of the appropriate length, then the default initial values are used instead. 
priors 
a named list of userspecified prior parameters:

scales 
a named list with names as in 
control 
a list of control values with components:

... 
options passed to the 
Function jointModelBayes
fits joint models for longitudinal and survival data under a Bayesian approach. For the longitudinal
responses a linear mixed effects model represented by the lmeObject
is assumed, unless the user specifies his own probability
density function using argument densLong
. For the survival times, let w_i denote the vector of baseline covariates in
survObject
, with associated parameter vector γ, m_i(t) the subjectspecific linear predictor at time point
t as defined by the mixed model (i.e., m_i(t) equals the fixedeffects part +
randomeffects part of the mixed
effects model for sample unit i), m_i'(t) denotes an extra userdefined term (based on the specification of argument
extraForm
) to be included in the linear predictor of the survival submodel, and α and α_e vector of
association parameters for m_i(t) and m_i'(t), respectively. Then, jointModelBayes
assumes a relative risk model of the form
h_i(t) = h_0(t) \exp\{γ^\top w_i + f(m_i(t), m_i'(t), b_i; α, α_e)\},
where the baseline risk function is approximated using splines, i.e.,
\log h_0(t) = ∑_k \tildeγ_k B(t; λ),
with B(.) denoting a Bspline basis function, λ a vector of knots, and \tilde γ_k the corresponding
splines coefficients (\tilde γ correspond to Bs.gammas
above). Argument baseHaz
specifies whether a
penalized or regressionsplineapproximation is employed. For the former the Psplines approach of Eilers and Marx (1996) is used,
namely the prior for \tilde γ is taken to be proportional to
p(\tilde γ) \propto \exp \Bigl( \frac{τ_{bs}}{2} \tilde γ^\top Δ^\top Δ \tilde γ \Bigr),
where Δ denotes the
differences matrix (the order of the differences is set by the control argument diff
).
Function f(m_i(t), m_i'(t), b_i; α, α_d) specifies the association structure between the two processes. In particular, for
param = "tdvalue"
,
f(m_i(t), m_i'(t), b_i; α, α_d) = f_1(m_i(t)) α,
for param = "tdextra"
,
f(m_i(t), m_i'(t), b_i; α, α_d) = f_2(m_i'(t)) α_e,
for param = "tdboth"
,
f(m_i(t), m_i'(t), b_i; α, α_d) = f_1(m_i(t)) α + f_2(m_i'(t)) α_e,
for param = "sharedRE"
,
f(m_i(t), m_i'(t), b_i; α, α_d) = α^\top b_i,
and for param = "sharedbetasRE"
,
f(m_i(t), m_i'(t), b_i; α, α_d) = α^\top (β^* + b_i),
where f_1(.) and f_2(.) denote possible transformation functions, b_i denotes the vector of random effects for the ith subject and β^* the fixed effects that correspond to the random effects.
See JMbayesObject
for the components of the fit.
1. The lmeObject
argument should represent a mixed model object without any special structure in the randomeffects
covariance matrix (i.e., no use of pdMats
).
2. The lmeObject
object should not contain any withingroup correlation structure (i.e., correlation
argument of lme()
) or withingroup heteroscedasticity structure (i.e., weights
argument of lme()
).
3. It is assumed that the linear mixed effects model lmeObject
and the survival model survObject
have been
fitted to the same subjects. Moreover, it is assumed that the ordering of the subjects is the same for both
lmeObject
and survObject
, i.e., that the first line in the data frame containing the event times
corresponds to the first set of lines identified by the grouping variable in the data frame containing the repeated
measurements, and so on. Furthermore, the scale of the time variable (e.g., days, months, years) should be the same in both
the lmeObject
and survObject
objects.
4. In the print
and summary
generic functions for class jointModel
, the estimated coefficients (and
standard errors for the summary
generic) for the event process are augmented with the element "Assoct" that
corresponds to the association parameter α and the element "AssoctE" that corresponds to the parameter
α_e when parameterization
is "tdextra"
or "tdboth"
(see Details).
Dimitris Rizopoulos d.rizopoulos@erasmusmc.nl
Henderson, R., Diggle, P. and Dobson, A. (2000) Joint modelling of longitudinal measurements and event time data. Biostatistics 1, 465–480.
Hsieh, F., Tseng, Y.K. and Wang, J.L. (2006) Joint modeling of survival and longitudinal data: Likelihood approach revisited. Biometrics 62, 1037–1043.
Rizopoulos, D. (2016). The R package JMbayes for fitting joint models for longitudinal and timetoevent data using MCMC. Journal of Statistical Software 72(7), 1–45. doi:10.18637/jss.v072.i07.
Rizopoulos, D. (2012) Joint Models for Longitudinal and TimetoEvent Data: With Applications in R. Boca Raton: Chapman and Hall/CRC.
Rizopoulos, D. (2011) Dynamic predictions and prospective accuracy in joint models for longitudinal and timetoevent data. Biometrics 67, 819–829.
Tsiatis, A. and Davidian, M. (2004) Joint modeling of longitudinal and timetoevent data: an overview. Statistica Sinica 14, 809–834.
Wulfsohn, M. and Tsiatis, A. (1997) A joint model for survival and longitudinal data measured with error. Biometrics 53, 330–339.
coef.JMbayes
,
ranef.JMbayes
,
logLik.JMbayes
,
survfitJM
,
aucJM
,
dynCJM
,
prederrJM
,
predict.JMbayes
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103  ## Not run:
# A joint model for the AIDS dataset:
# First we fit the linear mixed model for the longitudinal measurements of
# sqrt CD4 cell counts
lmeFit.aids < lme(CD4 ~ obstime * drug, random = ~ obstime  patient, data = aids)
# next we fit the Cox model for the time to death (including the 'x = TRUE' argument)
survFit.aids < coxph(Surv(Time, death) ~ drug, data = aids.id, x = TRUE)
# the corresponding joint model is fitted by (the default is to assume
# the current value parameterization)
jointFit.aids < jointModelBayes(lmeFit.aids, survFit.aids, timeVar = "obstime")
summary(jointFit.aids)
# A joint model for the PBC dataset:
# We first fit the linear mixed and Cox models. In the first we include
# splines to model flexibly the subjectspecific longitudinal trajectories
lmeFit.pbc < lme(log(serBilir) ~ ns(year, 2),
random = list(id = pdDiag(form = ~ ns(year, 2))), data = pbc2)
survFit.pbc < coxph(Surv(years, status2) ~ 1, data = pbc2.id, x = TRUE)
# the corresponding joint model is fitted by:
jointFit.pbc < jointModelBayes(lmeFit.pbc, survFit.pbc, timeVar = "year",
baseHaz = "regressionsplines")
summary(jointFit.pbc)
# we update the joint model fitted for the PBC dataset by including
# the timedependent slopes term. To achieve this we need to define
# the 'extraForm' argument, in which we use function dns() to numerically
# compute the derivative of the natural cubic spline. In addition, we increase
# the number of MCMC iterations to 35000
dform = list(fixed = ~ 0 + dns(year, 2), random = ~ 0 + dns(year, 2),
indFixed = 2:3, indRandom = 2:3)
jointFit.pbc2 < update(jointFit.pbc, param = "tdboth", extraForm = dform,
n.iter = 35000)
summary(jointFit.pbc2)
# we fit the same model with the shared random effects formulation
jointFit.pbc3 < update(jointFit.pbc, param = "sharedbetasRE")
summary(jointFit.pbc3)
# a joint model for left censored longitudinal data
# we create artificial left censoring in serum bilirubin
pbc2$CensInd < as.numeric(pbc2$serBilir <= 0.8)
pbc2$serBilir2 < pbc2$serBilir
pbc2$serBilir2[pbc2$CensInd == 1] < 0.8
censdLong < function (y, eta.y, scale, log = FALSE, data) {
log.f < dnorm(x = y, mean = eta.y, sd = scale, log = TRUE)
log.F < pnorm(q = y, mean = eta.y, sd = scale, log.p = TRUE)
ind < data$CensInd
if (log) {
(1  ind) * log.f + ind * log.F
} else {
exp((1  ind) * log.f + ind * log.F)
}
}
lmeFit.pbc2 < lme(log(serBilir2) ~ ns(year, 2), data = pbc2,
random = ~ ns(year, 2)  id, method = "ML")
jointFit.pbc4 < jointModelBayes(lmeFit.pbc2, survFit.pbc, timeVar = "year",
densLong = censdLong)
summary(jointFit.pbc4)
# a joint model for a binary outcome
pbc2$serBilirD < 1 * (pbc2$serBilir > 1.8)
lmeFit.pbc3 < glmmPQL(serBilirD ~ year, random = ~ year  id,
family = binomial, data = pbc2)
dLongBin < function (y, eta.y, scale, log = FALSE, data) {
dbinom(x = y, size = 1, prob = plogis(eta.y), log = log)
}
jointFit.pbc5 < jointModelBayes(lmeFit.pbc3, survFit.pbc, timeVar = "year",
densLong = dLongBin)
summary(jointFit.pbc5)
# create startstop counting process variables
pbc < pbc2[c("id", "serBilir", "drug", "year", "years",
"status2", "spiders")]
pbc$start < pbc$year
splitID < split(pbc[c("start", "years")], pbc$id)
pbc$stop < unlist(lapply(splitID,
function (d) c(d$start[1], d$years[1]) ))
pbc$event < with(pbc, ave(status2, id,
FUN = function (x) c(rep(0, length(x)1), x[1])))
pbc < pbc[!is.na(pbc$spiders), ]
# lefttruncation
pbc < pbc[pbc$start != 0, ]
lmeFit.pbc < lme(log(serBilir) ~ drug * ns(year, 2),
random = ~ ns(year, 2)  id, data = pbc)
tdCox.pbc < coxph(Surv(start, stop, event) ~ drug * spiders + cluster(id),
data = pbc, x = TRUE, model = TRUE)
jointFit.pbc6 < jointModelBayes(lmeFit.pbc, tdCox.pbc, timeVar = "year")
summary(jointFit.pbc6)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.