Title: | Joint Modelling of Multivariate Longitudinal Data and Time-to-Event Outcomes |
---|---|
Description: | Fits the joint model proposed by Henderson and colleagues (2000) <doi:10.1093/biostatistics/1.4.465>, but extended to the case of multiple continuous longitudinal measures. The time-to-event data is modelled using a Cox proportional hazards regression model with time-varying covariates. The multiple longitudinal outcomes are modelled using a multivariate version of the Laird and Ware linear mixed model. The association is captured by a multivariate latent Gaussian process. The model is estimated using a Monte Carlo Expectation Maximization algorithm. This project was funded by the Medical Research Council (Grant number MR/M013227/1). |
Authors: | Graeme L. Hickey [cre, aut] , Pete Philipson [aut] , Andrea Jorgensen [ctb] , Ruwanthi Kolamunnage-Dona [aut] , Paula Williamson [ctb] , Dimitris Rizopoulos [ctb, dtc] (data/renal.rda, R/hessian.R, R/vcov.R), Alessandro Gasparini [aut] , Medical Research Council [fnd] (Grant number: MR/M013227/1) |
Maintainer: | Graeme L. Hickey <[email protected]> |
License: | GPL-3 | file LICENSE |
Version: | 0.4.6 |
Built: | 2024-11-17 05:14:39 UTC |
Source: | https://github.com/graemeleehickey/joinerml |
mjoint
objectThis function returns the (baseline) hazard increment from a
fitted mjoint
object. In addition, it can report either the
uncentered or the more ubiquitous centered version.
baseHaz(object, centered = TRUE, se = FALSE)
baseHaz(object, centered = TRUE, se = FALSE)
object |
an object inheriting from class |
centered |
logical: should the baseline hazard be for the mean-centered
covariates model or not? Default is |
se |
logical: should standard errors be approximated for the hazard
increments? Default is |
When covariates are included in the time-to-event sub-model,
mjoint
automatically centers them about their respective
means. This also applies to non-continuous covariates, which are first
coded using a dummy-transformation for the design matrix and subsequently
centered. The reason for the mean-centering is to improve numerical
stability, as the survival function involves exponential terms. Extracting
the baseline hazard increments from mjoint.object
returns the
Breslow hazard estimate (Lin, 2007) that corresponds to this mean-centered
model. This is the same as is done in the R survival
package when
using coxph.detail
(Therneau and Grambsch, 2000).
If the user wants to access the baseline hazard estimate for the model in
which no mean-centering is applied, then they can use this function, which
scales the mean-centered baseline hazard by
where is a vector of the means from the time-to-event
sub-model design matrix.
A data.frame
with two columns: the unique failure times and
the estimate baseline hazard. If se=TRUE
, then a third column is
appended with the corresponding standard errors (for the centred case).
Graeme L. Hickey ([email protected])
Therneau TM, Grambsch PM. Modeling Survival Data: Extending the Cox Model. New Jersey: Springer-Verlag; 2000.
Lin DY. On the Breslow estimator. Lifetime Data Anal. 2007; 13(4): 471-480.
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) baseHaz(fit2, centered = FALSE) ## End(Not run)
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) baseHaz(fit2, centered = FALSE) ## End(Not run)
mjoint
objectThis function takes a model fit from an mjoint
object and
calculates standard errors and confidence intervals for the main
longitudinal and survival coefficient parameters, including the latent
association parameters, using bootstrapping (Efron and Tibshirani, 2000).
bootSE( object, nboot = 100, ci = 0.95, use.mle = TRUE, verbose = FALSE, control = list(), progress = TRUE, ncores = 1, safe.boot = FALSE, ... )
bootSE( object, nboot = 100, ci = 0.95, use.mle = TRUE, verbose = FALSE, control = list(), progress = TRUE, ncores = 1, safe.boot = FALSE, ... )
object |
an object inheriting from class |
nboot |
the number of bootstrap samples. Default is |
ci |
the confidence interval to be estimated using the
percentile-method. Default is |
use.mle |
logical: should the algorithm use the maximizer from the
converged model in |
verbose |
logical: if |
control |
a list of control values with components:
|
progress |
logical: should a progress bar be shown on the console to
indicate the percentage of bootstrap iterations completed? Default is
|
ncores |
integer: if more than one core is available, then the |
safe.boot |
logical: should each bootstrap replication be wrapped in a
|
... |
options passed to the |
Standard errors and confidence intervals are obtained by repeated fitting of the requisite joint model to bootstrap samples of the original longitudinal and time-to-event data. Note that bootstrap is done by sampling subjects, not individual records.
An object of class bootSE
.
This function is computationally intensive. A dynamic progress bar is
displayed showing the percentage of bootstrap models fitted. On computer
systems with more than one core available, computational time can be
reduced by passing the argument ncores
(with integer value >1) to
bootSE
, which implements parallel processing via the
foreach
package. Note: if parallel
processing is implemented, then the progress bar is not displayed.
Due to random sampling, an mjoint
model fitted to some bootstrap
samples may not converge within the specified control parameter settings.
The bootSE
code discards any models that failed to converge when
calculating the standard errors and confidence intervals. If a large
proportion of models have failed to converge, it is likely that it will
need to be refitted with changes to the control
arguments.
Graeme L. Hickey ([email protected])
Efron B, Tibshirani R. An Introduction to the Bootstrap. 2000; Boca Raton, FL: Chapman & Hall/CRC.
mjoint
for approximate standard errors.
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) fit.boot <- bootSE(fit, 50, use.mle = TRUE, control = list( burnin = 25, convCrit = "either", tol0 = 6e-03, tol2 = 6e-03, mcmaxIter = 60)) ## End(Not run)
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) fit.boot <- bootSE(fit, 50, use.mle = TRUE, control = list( burnin = 25, convCrit = "either", tol0 = 6e-03, tol2 = 6e-03, mcmaxIter = 60)) ## End(Not run)
mjoint
objectThis function computes confidence intervals for one or more
parameters in a fitted mjoint
object.
## S3 method for class 'mjoint' confint( object, parm = c("Both", "Longitudinal", "Event"), level = 0.95, bootSE = NULL, ... )
## S3 method for class 'mjoint' confint( object, parm = c("Both", "Longitudinal", "Event"), level = 0.95, bootSE = NULL, ... )
object |
an object inheriting from class |
parm |
a character string specifying which sub-model parameter
confidence intervals should be returned for. Can be specified as
|
level |
the confidence level required. Default is |
bootSE |
an object inheriting from class |
... |
additional arguments; currently none are used. |
A matrix containing the confidence intervals for either the longitudinal, time-to-event, or both sub-models.
Graeme L. Hickey ([email protected])
McLachlan GJ, Krishnan T. The EM Algorithm and Extensions. Second Edition. Wiley-Interscience; 2008.
Henderson R, Diggle PJ, Dobson A. Joint modelling of longitudinal measurements and event time data. Biostatistics. 2000; 1(4): 465-480.
Lin H, McCulloch CE, Mayne ST. Maximum likelihood estimation in the joint analysis of time-to-event and multiple longitudinal variables. Stat Med. 2002; 21: 2369-2382.
Wulfsohn MS, Tsiatis AA. A joint model for survival and longitudinal data measured with error. Biometrics. 1997; 53(1): 330-339.
mjoint
, bootSE
, and
confint
for the generic method description.
# Fit a classical univariate joint model with a single longitudinal outcome # and a single time-to-event outcome data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] gamma <- c(0.1059417, 1.0843359) sigma2 <- 0.03725999 beta <- c(4.9988669999, -0.0093527634, 0.0004317697) D <- matrix(c(0.128219108, -0.006665505, -0.006665505, 0.002468688), nrow = 2, byrow = TRUE) set.seed(1) fit1 <- mjoint(formLongFixed = log.lvmi ~ time + age, formLongRandom = ~ time | num, formSurv = Surv(fuyrs, status) ~ age, data = hvd, timeVar = "time", inits = list(gamma = gamma, sigma2 = sigma2, beta = beta, D = D), control = list(nMCscale = 2, burnin = 5)) # controls for illustration only confint(fit1, parm = "Longitudinal") ## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) confint(fit2) ## End(Not run)
# Fit a classical univariate joint model with a single longitudinal outcome # and a single time-to-event outcome data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] gamma <- c(0.1059417, 1.0843359) sigma2 <- 0.03725999 beta <- c(4.9988669999, -0.0093527634, 0.0004317697) D <- matrix(c(0.128219108, -0.006665505, -0.006665505, 0.002468688), nrow = 2, byrow = TRUE) set.seed(1) fit1 <- mjoint(formLongFixed = log.lvmi ~ time + age, formLongRandom = ~ time | num, formSurv = Surv(fuyrs, status) ~ age, data = hvd, timeVar = "time", inits = list(gamma = gamma, sigma2 = sigma2, beta = beta, D = D), control = list(nMCscale = 2, burnin = 5)) # controls for illustration only confint(fit1, parm = "Longitudinal") ## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) confint(fit2) ## End(Not run)
Calculates the conditional expected longitudinal values for a
new subject from the last observation time given their longitudinal
history data and a fitted mjoint
object.
dynLong( object, newdata, newSurvData = NULL, u = NULL, type = "first-order", M = 200, scale = 1.6, ci, progress = TRUE, ntimes = 100, level = 1 )
dynLong( object, newdata, newSurvData = NULL, u = NULL, type = "first-order", M = 200, scale = 1.6, ci, progress = TRUE, ntimes = 100, level = 1 )
object |
an object inheriting from class |
newdata |
a list of |
newSurvData |
a |
u |
an optional time that must be greater than the last observed
measurement time. If omitted (default is |
type |
a character string for whether a first-order
( |
M |
for |
scale |
a numeric scalar that scales the variance parameter of the proposal distribution for the Metropolis-Hastings algorithm, which therefore controls the acceptance rate of the sampling algorithm. |
ci |
a numeric value with value in the interval |
progress |
logical: should a progress bar be shown on the console to
indicate the percentage of simulations completed? Default is
|
ntimes |
an integer controlling the number of points to discretize the
extrapolated time region into. Default is |
level |
an optional integer giving the level of grouping to be used in
extracting the residuals from object. Level values increase from outermost
to innermost grouping, with level 0 corresponding to the population model
fit and level 1 corresponding to subject-specific model fit. Defaults to
|
Dynamic predictions for the longitudinal data sub-model based on an observed measurement history for the longitudinal outcomes of a new subject are based on either a first-order approximation or Monte Carlo simulation approach, both of which are described in Rizopoulos (2011). Namely, given that the subject was last observed at time t, we calculate the conditional expectation of each longitudinal outcome at time u as
where is the failure time for the new subject, and
is the
stacked-vector of longitudinal measurements up to time t.
First order predictions
For type="first-order"
, is the mode of the posterior
distribution of the random effects given by
The predictions are based on plugging in , which
is extracted from the
mjoint
object.
Monte Carlo simulation predictions
For type="simulated"
, is drawn from a multivariate
normal distribution with means
and variance-covariance
matrix both extracted from the fitted
mjoint
object via the
coef()
and vcov()
functions. is drawn from the
the posterior distribution of the random effects
by means of a Metropolis-Hasting algorithm with independent multivariate
non-central t-distribution proposal distributions with
non-centrality parameter from the first-order prediction and
variance-covariance matrix equal to
scale
the inverse
of the negative Hessian of the posterior distribution. The choice os
scale
can be used to tune the acceptance rate of the
Metropolis-Hastings sampler. This simulation algorithm is iterated M
times, at each time calculating the conditional survival probability.
A list object inheriting from class dynLong
. The list returns
the arguments of the function and a list containing K
data.frame
s of 2 columns, with first column (named
timeVar[k]
; see mjoint
) denoting times and the second
column (named y.pred
) denoting the expected outcome at each time
point.
Graeme L. Hickey ([email protected])
Rizopoulos D. Dynamic predictions and prospective accuracy in joint models for longitudinal and time-to-event data. Biometrics. 2011; 67: 819–829.
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) hvd2 <- droplevels(hvd[hvd$num == 1, ]) dynLong(fit2, hvd2) dynLong(fit2, hvd2, u = 7) # outcomes at 7-years only out <- dynLong(fit2, hvd2, type = "simulated") out ## End(Not run)
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) hvd2 <- droplevels(hvd[hvd$num == 1, ]) dynLong(fit2, hvd2) dynLong(fit2, hvd2, u = 7) # outcomes at 7-years only out <- dynLong(fit2, hvd2, type = "simulated") out ## End(Not run)
Calculates the conditional time-to-event distribution for a
new subject from the last observation time given their longitudinal
history data and a fitted mjoint
object.
dynSurv( object, newdata, newSurvData = NULL, u = NULL, horizon = NULL, type = "first-order", M = 200, scale = 2, ci, progress = TRUE )
dynSurv( object, newdata, newSurvData = NULL, u = NULL, horizon = NULL, type = "first-order", M = 200, scale = 2, ci, progress = TRUE )
object |
an object inheriting from class |
newdata |
a list of |
newSurvData |
a |
u |
an optional time that must be greater than the last observed
measurement time. If omitted (default is |
horizon |
an optional horizon time. Instead of specifying a specific
time |
type |
a character string for whether a first-order
( |
M |
for |
scale |
a numeric scalar that scales the variance parameter of the proposal distribution for the Metropolis-Hastings algorithm, which therefore controls the acceptance rate of the sampling algorithm. |
ci |
a numeric value with value in the interval |
progress |
logical: should a progress bar be shown on the console to
indicate the percentage of simulations completed? Default is
|
Dynamic predictions for the time-to-event data sub-model based on an
observed measurement history for the longitudinal outcomes of a new subject
are based on either a first-order approximation or Monte Carlo simulation
approach, both of which are described in Rizopoulos (2011). Namely, given
that the subject was last observed at time t, we calculate the
conditional survival probability at time as
where is the failure time for the new subject,
is the
stacked-vector of longitudinal measurements up to time t and
is the survival function.
First order predictions
For type="first-order"
, is the mode
of the posterior distribution of the random effects given by
The predictions are based on plugging in , which
is extracted from the
mjoint
object.
Monte Carlo simulation predictions
For type="simulated"
, is drawn from a multivariate
normal distribution with means
and variance-covariance
matrix both extracted from the fitted
mjoint
object via the
coef()
and vcov()
functions. is drawn from the
the posterior distribution of the random effects
by means of a Metropolis-Hasting algorithm with independent multivariate
non-central t-distribution proposal distributions with
non-centrality parameter from the first-order prediction and
variance-covariance matrix equal to
scale
the inverse
of the negative Hessian of the posterior distribution. The choice os
scale
can be used to tune the acceptance rate of the
Metropolis-Hastings sampler. This simulation algorithm is iterated M
times, at each time calculating the conditional survival probability.
A list object inheriting from class dynSurv
. The list returns
the arguments of the function and a data.frame
with first column
(named u
) denoting times and the subsequent columns returning
summary statistics for the conditional failure probabilities For
type="first-order"
, a single column named surv
is appended.
For type="simulated"
, four columns named mean
, median
,
lower
and upper
are appended, denoting the mean, median and
lower and upper confidence intervals from the Monte Carlo draws. Additional
objects are returned that are used in the intermediate calculations.
Graeme L. Hickey ([email protected])
Rizopoulos D. Dynamic predictions and prospective accuracy in joint models for longitudinal and time-to-event data. Biometrics. 2011; 67: 819–829.
Taylor JMG, Park Y, Ankerst DP, Proust-Lima C, Williams S, Kestin L, et al. Real-time individual predictions of prostate cancer recurrence using joint models. Biometrics. 2013; 69: 206–13.
mjoint
, dynLong
, and
plot.dynSurv
.
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) hvd2 <- droplevels(hvd[hvd$num == 1, ]) dynSurv(fit2, hvd2) dynSurv(fit2, hvd2, u = 7) # survival at 7-years only out <- dynSurv(fit2, hvd2, type = "simulated") out ## End(Not run)
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) hvd2 <- droplevels(hvd[hvd$num == 1, ]) dynSurv(fit2, hvd2) dynSurv(fit2, hvd2, u = 7) # survival at 7-years only out <- dynSurv(fit2, hvd2, type = "simulated") out ## End(Not run)
The SANAD (Standard and New Antiepileptic Drugs) study (Marson et al., 2007) is a randomised control trial of standard and new antiepileptic drugs, comparing effects on longer term clinical outcomes. Quality of life (QoL) data were collected by mail at baseline, 3 months, and at 1 and 2 years using validated measures. This data is a subset of the trial for 544 patients randomised to one of 2 drugs: carbamazepine and lamotrigine.
data(epileptic.qol)
data(epileptic.qol)
A data frame with 1853 observations on the following 9 variables:
id
patients identifier; in total there are 544 patients.
with.time
number of days between registration and the earlier of treatment failure or study analysis time.
trt
a factor with levels CBZ
and LTG
denoting
carbamazepine and lamotrigine, respectively.
with.status
the reason for treatment failure. Coded as
0=
censored; 1=
unacceptable adverse effects;
2=
inadequate seizure control.
time
the time the quality of life measures were recorded (days). The first measurement for each subject is the baseline measurement, however there was variability between the time taken to return the questionnaires; hence the reason this is non-zero. Similarly, the second, third, and fourth follow-up times, which were scheduled for 3-months, 1-year, and 2-years, respectively, also had variability in completion times.
anxiety
a continuous measure of anxiety, as defined according to the NEWQOL (Newly Diagnosed Epilepsy Quality of Life) assessment. Higher scores are indicative of worse QoL.
depress
a continuous measure of depression, as defined according to the NEWQOL (Newly Diagnosed Epilepsy Quality of Life) assessment. Higher scores are indicative of worse QoL.
aep
a continuous measure of the Liverpool Adverse Events Profile (AEP), as defined according to the NEWQOL (Newly Diagnosed Epilepsy Quality of Life) assessment. Higher scores are indicative of worse QoL.
with.status2
a binary indicator of composite treatment
failure (for any reason), coded status2=1
, or right-censoring
status2=0
.
SANAD Trial: University of Liverpool. See Jacoby et al. (2015).
Jacoby A, Sudell M, Tudur Smith C, et al. Quality-of-life outcomes of initiating treatment with standard and newer antiepileptic drugs in adults with new-onset epilepsy: Findings from the SANAD trial. Epilepsia. 2015; 56(3): 460-472.
Marson AG, Appleton R, Baker GA, et al. A randomised controlled trial examining longer-term outcomes of standard versus new antiepileptic drugs. The SANAD Trial. Health Technology Assessment. 2007; 11(37).
Marson AG, Al-Kharusi AM, Alwaidh M, et al. The SANAD study of effectiveness of carbamazepine, gabapentin, lamotrigine, oxcarbazepine, or topiramate for treatment of partial epilepsy: an unblinded randomised controlled trial. Lancet. 2007; 365: 2007-2013.
Abetz L, Jacoby A, Baker GA, et al. Patient-based assessments of quality of life in newly diagnosed epilepsy patients: validation of the NEWQOL. Epilepsia. 2000; 41: 1119-1128.
pbc2
, heart.valve
, renal
.
mjoint
fitted valuesThe fitted values at level i are obtained by adding together the population fitted values (based only on the fixed effects estimates) and the estimated contributions of the random effects.
## S3 method for class 'mjoint' fitted(object, level = 0, ...)
## S3 method for class 'mjoint' fitted(object, level = 0, ...)
object |
an object inheriting from class |
level |
an optional integer giving the level of grouping to be used in extracting the fitted values from object. Level values increase from outermost to innermost grouping, with level 0 corresponding to the population fitted values and level 1 corresponding to subject-specific fitted values Defaults to level 0. |
... |
additional arguments; currently none are used. |
A list
of length K with each element a vector of
fitted values for the k-th longitudinal outcome.
Graeme L. Hickey ([email protected])
Pinheiro JC, Bates DM. Mixed-Effects Models in S and S-PLUS. New York: Springer Verlag; 2000.
mjoint
objectExtract fixed effects estimates from an mjoint
object.
## S3 method for class 'mjoint' fixef(object, process = c("Longitudinal", "Event"), ...)
## S3 method for class 'mjoint' fixef(object, process = c("Longitudinal", "Event"), ...)
object |
an object inheriting from class |
process |
character string: if |
... |
additional arguments; currently none are used. |
A named vector of length equal to the number of sub-model coefficients estimated.
Graeme L. Hickey ([email protected])
Pinheiro JC, Bates DM. Mixed-Effects Models in S and S-PLUS. New York: Springer Verlag; 2000.
Wulfsohn MS, Tsiatis AA. A joint model for survival and longitudinal data measured with error. Biometrics. 1997; 53(1): 330-339.
fixef
for the generic method description, and
ranef.mjoint
.
# Fit a classical univariate joint model with a single longitudinal outcome # and a single time-to-event outcome data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] set.seed(1) fit1 <- mjoint(formLongFixed = log.lvmi ~ time + age, formLongRandom = ~ time | num, formSurv = Surv(fuyrs, status) ~ age, data = hvd, timeVar = "time", control = list(nMCscale = 2, burnin = 5)) # controls for illustration only fixef(fit1, process = "Longitudinal") fixef(fit1, process = "Event") ## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) fixef(fit2, process = "Longitudinal") fixef(fit2, process = "Event") ## End(Not run)
# Fit a classical univariate joint model with a single longitudinal outcome # and a single time-to-event outcome data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] set.seed(1) fit1 <- mjoint(formLongFixed = log.lvmi ~ time + age, formLongRandom = ~ time | num, formSurv = Surv(fuyrs, status) ~ age, data = hvd, timeVar = "time", control = list(nMCscale = 2, burnin = 5)) # controls for illustration only fixef(fit1, process = "Longitudinal") fixef(fit1, process = "Event") ## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) fixef(fit2, process = "Longitudinal") fixef(fit2, process = "Event") ## End(Not run)
mjoint
objectExtract model formulae from an mjoint
object.
## S3 method for class 'mjoint' formula(x, process = c("Longitudinal", "Event"), k = 1, ...)
## S3 method for class 'mjoint' formula(x, process = c("Longitudinal", "Event"), k = 1, ...)
x |
an object inheriting from class |
process |
character string: if |
k |
integer: a number between 1 and K (the total number of longitudinal outcomes) that specifies the longitudinal outcome of interest. |
... |
additional arguments; currently none are used. |
An object of class "formula" which contains a symbolic model formula for the separate sub-model fixed effect terms only.
Graeme L. Hickey ([email protected])
Pinheiro JC, Bates DM. Mixed-Effects Models in S and S-PLUS. New York: Springer Verlag; 2000.
Wulfsohn MS, Tsiatis AA. A joint model for survival and longitudinal data measured with error. Biometrics. 1997; 53(1): 330-339.
formula
for the generic method description, and
ranef.mjoint
.
mjoint
objectExtract variance-covariance matrix of random effects from an
mjoint
object.
## S3 method for class 'mjoint' getVarCov(obj, ...)
## S3 method for class 'mjoint' getVarCov(obj, ...)
obj |
an object inheriting from class |
... |
additional arguments; currently none are used. |
A variance-covariance matrix.
Graeme L. Hickey ([email protected])
Pinheiro JC, Bates DM. Mixed-Effects Models in S and S-PLUS. New York: Springer Verlag; 2000.
getVarCov
for the generic method description.
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) getVarCov(fit2) ## End(Not run)
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) getVarCov(fit2) ## End(Not run)
This is longitudinal data on an observational study on detecting effects of different heart valves, differing on type of tissue, implanted in the aortic position. The data consists of longitudinal measurements on three different heart function outcomes, after surgery occurred. There are several baseline covariates available, and also survival data.
data(heart.valve)
data(heart.valve)
This is a data frame in the unbalanced format, that is, with one row per observation. The data consists in columns for patient identification, time of measurements, longitudinal multiple longitudinal measurements, baseline covariates, and survival data. The column names are identified as follows:
num
number for patient identification.
sex
gender of patient (0=
Male and 1=
Female).
age
age of patient at day of surgery (years).
time
observed time point, with surgery date as the time origin (years).
fuyrs
maximum follow up time, with surgery date as the time origin (years).
status
censoring indicator (1=
died and 0=
lost
at follow up).
grad
valve gradient at follow-up visit.
log.grad
natural log transformation of grad
.
lvmi
left ventricular mass index (standardised) at follow-up visit.
log.lvmi
natural log transformation of lvmi
.
ef
ejection fraction at follow-up visit.
bsa
preoperative body surface area.
lvh
preoperative left ventricular hypertrophy.
prenyha
preoperative New York Heart Association (NYHA)
classification (1=
I/II and 3=
III/IV).
redo
previous cardiac surgery.
size
size of the valve (millimeters).
con.cabg
concomitant coronary artery bypass graft.
creat
preoperative serum creatinine (mol/mL).
dm
preoperative diabetes.
acei
preoperative use of ace inhibitor.
lv
preoperative left ventricular ejection fraction (LVEF)
(1=
good, 2=
moderate, and 3=
poor).
emergenc
operative urgency (0=
elective, 1 =
urgent, and 3=
emergency).
hc
preoperative high cholesterol (0=
absent, 1
=
present treated, and 2=
present untreated).
sten.reg.mix
aortic valve haemodynamics (1=
stenosis,
2=
regurgitation, 3=
mixed).
hs
implanted aortic prosthesis type (1=
homograft and
0=
stentless porcine tissue).
Lim E, Ali A, Theodorou P, Sousa I, Ashrafian H, Chamageorgakis T, Duncan M, Diggle P, Pepper J. A longitudinal study of the profile and predictors of left ventricular mass regression after stentless aortic valve replacement. Ann Thorac Surg. 2008; 85(6): 2026-2029.
joineRML is an extension of the joineR package for fitting joint
models of time-to-event data and multivariate longitudinal data. The model
fitted in joineRML is an extension of the Wulfsohn and Tsiatis (1997) and
Henderson et al. (2000) models, which is comprised on
-sub-models: a Cox proportional hazards regression model (Cox,
1972) and a K-variate linear mixed-effects model - a direct
extension of the Laird and Ware (1982) regression model. The model is
fitted using a Monte Carlo Expectation-Maximization (MCEM) algorithm, which
closely follows the methodology presented by Lin et al. (2002).
Wulfsohn MS, Tsiatis AA. A joint model for survival and longitudinal data measured with error. Biometrics. 1997; 53(1): 330-339.
Henderson R, Diggle PJ, Dobson A. Joint modelling of longitudinal measurements and event time data. Biostatistics. 2000; 1(4): 465-480.
Cox DR. Regression models and life-tables. J R Stat Soc Ser B Stat Methodol. 1972; 34(2): 187-220.
Laird NM, Ware JH. Random-effects models for longitudinal data. Biometrics. 1982; 38(4): 963-974.
mjoint
objectExtract log-likelihood from an mjoint
object.
## S3 method for class 'mjoint' logLik(object, ...)
## S3 method for class 'mjoint' logLik(object, ...)
object |
an object inheriting from class |
... |
additional arguments; currently none are used. |
Returns an object of class logLik
. This is a number with two
attributes: df
(degrees of freedom), giving the number of parameters
in the model, and nobs
, the number of observations used in
estimation.
Graeme L. Hickey ([email protected])
Henderson R, Diggle PJ, Dobson A. Joint modelling of longitudinal measurements and event time data. Biostatistics. 2000; 1(4): 465-480.
logLik
for the generic method description.
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) logLik(fit2) ## End(Not run)
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) logLik(fit2) ## End(Not run)
This function fits the joint model proposed by Henderson et al. (2000), but extended to the case of multiple continuous longitudinal measures. The time-to-event data is modelled using a Cox proportional hazards regression model with time-varying covariates. The multiple longitudinal outcomes are modelled using a multivariate version of the Laird and Ware linear mixed model. The association is captured by a multivariate latent Gaussian process. The model is estimated using a (quasi-) Monte Carlo Expectation Maximization (MCEM) algorithm.
mjoint( formLongFixed, formLongRandom, formSurv, data, survData = NULL, timeVar, inits = NULL, verbose = FALSE, pfs = TRUE, control = list(), ... )
mjoint( formLongFixed, formLongRandom, formSurv, data, survData = NULL, timeVar, inits = NULL, verbose = FALSE, pfs = TRUE, control = list(), ... )
formLongFixed |
a list of formulae for the fixed effects component of each longitudinal outcome. The left hand-hand side defines the response, and the right-hand side specifies the fixed effect terms. If a single formula is given (either as a list of length 1 or a formula), then it is assumed that a standard univariate joint model is being fitted. |
formLongRandom |
a list of one-sided formulae specifying the model for
the random effects effects of each longitudinal outcome. The length of the
list must be equal to |
formSurv |
a formula specifying the proportional hazards regression
model (not including the latent association structure). See
|
data |
a list of |
survData |
a |
timeVar |
a character string indicating the time variable in the linear mixed effects model. If there are multiple longitudinal outcomes and the time variable is labelled differently in each model, then a character string vector can be given instead. |
inits |
a list of initial values for some or all of the parameters
estimated in the model. Default is |
verbose |
logical: if |
pfs |
logical: if |
control |
a list of control values with components:
|
... |
options passed to the |
Function mjoint
fits joint models for time-to-event and
multivariate longitudinal data. A review of relevant statistical
methodology for joint models of multivariate data is given in Hickey et al.
(2016). This is a direct extension of the models developed in the seminal
works of Wulfsohn and Tsiatis (1997) and Henderson et al. (2000), with the
calculations based largely on Lin et al. (2002) who also extended the model
to multivariate joint data. A more detailed explanation of the model
formulation is given in the technical vignette. Each longitudinal outcome
is modelled according to a linear mixed model (LMM), akin to the models fit
by lme
, with independent and identically distributed
Gaussian errors. The latent term in each model (specified by
formLongRandom
) is a linear combination of subject-specific
zero-mean Gaussian random effects with outcome-specific variance
components. We denote these as ,
,
,
, for the K-outcomes.
Usually,
will be specified as either
(a
random-intercepts model) or
(a random-intercepts and
random-slopes model); however, more general structures are allowed The
time-to-event model is modelled as per the usual Cox model formulation,
with an additional (possibly) time-varying term given by
where is a parameter vector of proportional latent
association parameters of length K for estimation.
The optimization routine is based on a Monte Carlo Expectation Maximization algorithm (MCEM) algorithm, as described by Wei and Tanner (1990). With options for using antithetic simulation for variance reduction in the Monte Carlo integration, or quasi-Monte Carlo based on low order deterministic sequences.
An object of class mjoint
. See mjoint.object
for
details.
The routine internally scales and centers data to avoid overflow in the argument to the exponential function. These actions do not change the result, but lead to more numerical stability. Several convergence criteria are available:
abs
the maximum absolute parameter change is
tol0
. The baseline hazard parameters are not included in this
convergence statistic.
rel
the maximum (absolute) relative parameter change is
tol2
. A small value (tol1
) is added to the denominator
of the relative change statistic to avoid numerical problems when the
parameters are close to zero.
either
either the abs
or rel
criteria
are satisfied.
sas
if rav
, then the abs
criteria is applied for the l-th parameter; otherwise, rel
is
applied. This is the approach used in the SAS EM algorithm program for
missing data.
Due to the Monte Caro error, the algorithm could spuriously declare convergence. Therefore, we require convergence to be satisfied for 3 consecutive iterations. The algorithm starts with a low number of Monte Carlo samples in the 'burn-in' phase, as it would be computationally inefficient to use a large sample whilst far away from the true maximizer. After the algorithm moves out of this adaptive phase, it uses an automated criterion based on the coefficient of variation of the relative parameter change of the last 3 iterations to decide whether to increase the Monte Carlo sample size. See the technical vignette and Ripatti et al. (2002) for further details.
Approximate standard errors (SEs) are calculated (if pfs=TRUE
).
These are based on the empirical observed information function (McLachlan &
Krishnan, 2008). Through simulation studies, we have found that this
approximation does not work particularly well for (where
n is the number of subjects). In these cases, one would need to
appeal to the bootstrap SE estimation approach. However, in practice, the
reliability of the approximate SEs will depend of a multitude of factors,
including but not limited to, the average number of repeated measurements
per subject, the total number of events, and the convergence of the MCEM
algorithm.
Bootstrap SEs are also available, however they are not calculated using the
mjoint
function due to the intense computational time. Instead, a
separate function is available: bootSE
, which takes the fitted joint
model as its main argument. Given a fitted joint model (of class
mjoint
) and a bootstrap fit object (of class bootSE
), the SEs
reported in the model can be updated by running
summary(fit_obj,boot_obj)
. For details, consult the
bootSE
documentation.
Graeme L. Hickey ([email protected])
Henderson R, Diggle PJ, Dobson A. Joint modelling of longitudinal measurements and event time data. Biostatistics. 2000; 1(4): 465-480.
Hickey GL, Philipson P, Jorgensen A, Kolamunnage-Dona R. Joint modelling of time-to-event and multivariate longitudinal outcomes: recent developments and issues. BMC Med Res Methodol. 2016; 16(1): 117.
Lin H, McCulloch CE, Mayne ST. Maximum likelihood estimation in the joint analysis of time-to-event and multiple longitudinal variables. Stat Med. 2002; 21: 2369-2382.
McLachlan GJ, Krishnan T. The EM Algorithm and Extensions. Second Edition. Wiley-Interscience; 2008.
Ripatti S, Larsen K, Palmgren J. Maximum likelihood inference for multivariate frailty models using an automated Monte Carlo EM algorithm. Lifetime Data Anal. 2002; 8: 349-360.
Wei GC, Tanner MA. A Monte Carlo implementation of the EM algorithm and the poor man's data augmentation algorithms. J Am Stat Assoc. 1990; 85(411): 699-704.
Wulfsohn MS, Tsiatis AA. A joint model for survival and longitudinal data measured with error. Biometrics. 1997; 53(1): 330-339.
mjoint.object
, bootSE
,
plot.mjoint
, summary.mjoint
,
getVarCov.mjoint
, simData
.
# Fit a classical univariate joint model with a single longitudinal outcome # and a single time-to-event outcome data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] set.seed(1) fit1 <- mjoint(formLongFixed = log.lvmi ~ time + age, formLongRandom = ~ time | num, formSurv = Surv(fuyrs, status) ~ age, data = hvd, timeVar = "time", control = list(nMCscale = 2, burnin = 5)) # controls for illustration only summary(fit1) ## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) summary(fit2) ## End(Not run) ## Not run: # Fit a univariate joint model and compare to the joineR package data(pbc2) pbc2$log.b <- log(pbc2$serBilir) # joineRML package fit.joineRML <- mjoint( formLongFixed = list("log.bil" = log.b ~ year), formLongRandom = list("log.bil" = ~ 1 | id), formSurv = Surv(years, status2) ~ age, data = pbc2, timeVar = "year") summary(fit.joineRML) # joineR package pbc.surv <- UniqueVariables(pbc2, var.col = c("years", "status2"), id.col = "id") pbc.long <- pbc2[, c("id", "year", "log.b")] pbc.cov <- UniqueVariables(pbc2, "age", id.col = "id") pbc.jd <- jointdata(longitudinal = pbc.long, baseline = pbc.cov, survival = pbc.surv, id.col = "id", time.col = "year") fit.joineR <- joint(data = pbc.jd, long.formula = log.b ~ 1 + year, surv.formula = Surv(years, status2) ~ age, model = "int") summary(fit.joineR) ## End(Not run)
# Fit a classical univariate joint model with a single longitudinal outcome # and a single time-to-event outcome data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] set.seed(1) fit1 <- mjoint(formLongFixed = log.lvmi ~ time + age, formLongRandom = ~ time | num, formSurv = Surv(fuyrs, status) ~ age, data = hvd, timeVar = "time", control = list(nMCscale = 2, burnin = 5)) # controls for illustration only summary(fit1) ## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) summary(fit2) ## End(Not run) ## Not run: # Fit a univariate joint model and compare to the joineR package data(pbc2) pbc2$log.b <- log(pbc2$serBilir) # joineRML package fit.joineRML <- mjoint( formLongFixed = list("log.bil" = log.b ~ year), formLongRandom = list("log.bil" = ~ 1 | id), formSurv = Surv(years, status2) ~ age, data = pbc2, timeVar = "year") summary(fit.joineRML) # joineR package pbc.surv <- UniqueVariables(pbc2, var.col = c("years", "status2"), id.col = "id") pbc.long <- pbc2[, c("id", "year", "log.b")] pbc.cov <- UniqueVariables(pbc2, "age", id.col = "id") pbc.jd <- jointdata(longitudinal = pbc.long, baseline = pbc.cov, survival = pbc.surv, id.col = "id", time.col = "year") fit.joineR <- joint(data = pbc.jd, long.formula = log.b ~ 1 + year, surv.formula = Surv(years, status2) ~ age, model = "int") summary(fit.joineR) ## End(Not run)
These methods tidy the coefficients of joint models for time-to-event data
and multivariate longitudinal data of the mjoint
class from the
joineRML
package.
## S3 method for class 'mjoint' tidy( x, component = "survival", bootSE = NULL, conf.int = FALSE, conf.level = 0.95, ... ) ## S3 method for class 'mjoint' augment(x, data = x$data, ...) ## S3 method for class 'mjoint' glance(x, ...)
## S3 method for class 'mjoint' tidy( x, component = "survival", bootSE = NULL, conf.int = FALSE, conf.level = 0.95, ... ) ## S3 method for class 'mjoint' augment(x, data = x$data, ...) ## S3 method for class 'mjoint' glance(x, ...)
x |
An object of class |
component |
Either |
bootSE |
An object of class |
conf.int |
Include (1 - |
conf.level |
The confidence level required. |
... |
extra arguments (not used) |
data |
Original data this was fitted on, in a list (e.g.
|
All tidying methods return a data.frame
without rownames. The
structure depends on the method chosen.
tidy
returns one row for each estimated fixed effect depending
on the component
parameter. It contains the following columns:
term |
The term being estimated |
estimate |
Estimated value |
std.error |
Standard error |
statistic |
Z-statistic |
p.value |
P-value computed from Z-statistic |
conf.low |
The lower
bound of a confidence interval on |
conf.high |
The upper bound of a confidence interval on
|
.
augment
returns one row for each original observation, with
columns (each prepended by a .) added. Included are the columns:
.fitted_j_0 |
population-level fitted values for the j-th longitudinal process |
.fitted_j_1 |
individuals-level fitted values for the j-th longitudinal process |
.resid_j_0 |
population-level residuals for the j-th longitudinal process |
.resid_j_1 |
individual-level residuals for the j-th longitudinal process |
See fitted.mjoint
and residuals.mjoint
for more information on the
difference between population-level and individual-level fitted values and
residuals.
glance
returns one row with the columns
sigma2_j |
the square root of the estimated residual variance for the j-th longitudinal process |
AIC |
the Akaike Information Criterion |
BIC |
the Bayesian Information Criterion |
logLik |
the data's log-likelihood under the model |
.
If fitting a joint model with a single longitudinal process, please
make sure you are using a named list
to define the formula for the
fixed and random effects of the longitudinal submodel.
Alessandro Gasparini ([email protected])
Alessandro Gasparini ([email protected])
Alessandro Gasparini ([email protected])
## Not run: # Fit a joint model with bivariate longitudinal outcomes library(joineRML) data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi) & heart.valve$num <= 50, ] fit <- mjoint( formLongFixed = list( "grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex ), formLongRandom = list( "grad" = ~ 1 | num, "lvmi" = ~ time | num ), formSurv = Surv(fuyrs, status) ~ age, data = hvd, inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time" ) # Extract the survival fixed effects tidy(fit) # Extract the longitudinal fixed effects tidy(fit, component = "longitudinal") # Extract the survival fixed effects with confidence intervals tidy(fit, ci = TRUE) # Extract the survival fixed effects with confidence intervals based on bootstrapped standard errors bSE <- bootSE(fit, nboot = 5, safe.boot = TRUE) tidy(fit, bootSE = bSE, ci = TRUE) # Augment original data with fitted longitudinal values and residuals hvd2 <- augment(fit) # Extract model statistics glance(fit) ## End(Not run)
## Not run: # Fit a joint model with bivariate longitudinal outcomes library(joineRML) data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi) & heart.valve$num <= 50, ] fit <- mjoint( formLongFixed = list( "grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex ), formLongRandom = list( "grad" = ~ 1 | num, "lvmi" = ~ time | num ), formSurv = Surv(fuyrs, status) ~ age, data = hvd, inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time" ) # Extract the survival fixed effects tidy(fit) # Extract the longitudinal fixed effects tidy(fit, component = "longitudinal") # Extract the survival fixed effects with confidence intervals tidy(fit, ci = TRUE) # Extract the survival fixed effects with confidence intervals based on bootstrapped standard errors bSE <- bootSE(fit, nboot = 5, safe.boot = TRUE) tidy(fit, bootSE = bSE, ci = TRUE) # Augment original data with fitted longitudinal values and residuals hvd2 <- augment(fit) # Extract model statistics glance(fit) ## End(Not run)
mjoint
objectAn object returned by the mjoint
function, inheriting
from class mjoint
and representing a fitted joint model for
multivariate longitudinal and time-to-event data. Objects of this class
have methods for the generic functions coef
, logLik
,
plot
, print
, ranef
, fixef
, summary
,
AIC
, getVarCov
, vcov
, confint
, sigma
,
fitted
, residuals
, and formula
.
mjoint.object
mjoint.object
An object of class NULL
of length 0.
A list with the following components.
coefficients
a list with the estimated coefficients. The components of this list are:
beta
the vector of fixed effects for the linear mixed effects sub-model.
D
the variance-covariance matrix of the random effects.
sigma2
the measurement error standard deviations for the linear mixed effects sub-model.
haz
the estimated baseline hazard values for each unique
failure time. Note that this is the centered hazard, equivalent to
that returned by coxph.detail
.
gamma
the vector of baseline covariates for the survival model and the latent association coefficient parameter estimates.
history
a matrix with parameter estimates at each iteration of the MCEM algorithm.
nMC.hx
a vector with the number of Monte Carlo samples for each MCEM algorithm iteration.
formLongFixed
a list of formulae for the fixed effects component of each longitudinal outcome.
formLongRandom
a list of formulae for the fixed effects
component of each longitudinal outcome. The length of the list will be
equal to formLongFixed
.
formSurv
a formula specifying the proportional hazards regression model (not including the latent association structure).
data
a list of data.frames for each longitudinal outcome.
survData
a data.frame of the time-to-event dataset.
timeVar
a character string vector of length K denoting the
column name(s) for time in data
.
id
a character string denoting the column name for subject
IDs in data
and survData
.
dims
a list giving the dimensions of model parameters with components:
p
a vector of the number of fixed effects for each longitudinal outcome.
r
a vector of the number of random effects for each longitudinal outcome.
K
an integer of the number of different longitudinal outcome types.
q
an integer of the number of baseline covariates in the time-to-event sub-model.
n
an integer of the total number of subjects in the study.
nk
a vector of the number of measurements for each longitudinal outcome.
sfit
an object of class coxph
for the separate
time-to-event model fit. See coxph
for details.
lfit
a list of objects each of class lme
from fitting
separate linear mixed effects models; one per each longitudinal outcome
type. See lme
for details.
log.lik0
the combined log-likelihood from separate sub-model fits.
log.lik
the log-likelihood from the joint model fit.
ll.hx
a vector of the log-likelihood values for each MCEM algorithm interaction.
control
a list of control parameters used in the estimation
of the joint model. See mjoint
for details.
finalnMC
the final number of Monte Carlo samples required prior to convergence.
call
the matched call.
inits
the initial values passed as an argument in the
mjoint
function.
inits.long
the computed initial values from fitting a multivariate longitudinal model.
inits.surv
the computed initial values from fitting a Cox proportional hazards model with time-dependent covariates calculated from the fitted multivariate LME model.
conv
logical: did the MCEM algorithm converge within the specified maximum number of iterations?
comp.time
a vector of length 2 with each element an object of
class difftime
that reports the total time taken for model
fitting (including all stages) and the time spent in the EM
algorithm.
If pfs=TRUE
, indicating that post-fit statistics are to be returned,
then the output also includes the following objects.
vcov
the variance-covariance matrix of model parameters, as
approximated by the empirical information matrix, is reported. See
mjoint
for details.
SE.approx
the square-root of the diagonal of vcov
is
returned, which are estimates of the standard errors for the parameters.
Eb
a matrix with the estimated random effects values for each subject.
Vb
an array with the estimated variance-covariance matrices for the random effects values for each subject.
dmats
a list of length 3 containing the design matrices,
data frames, and vectors used in the MCEM algorithm. These are required
for prediction and to calculate the residuals and . The 3 items in the
list are l
(longitudinal data), t
(time-to-event data), and
z
(design matrices expanded over unique failure times). These are
not intended to be extracted by the user.
Graeme L. Hickey ([email protected])
This data is from the Mayo Clinic trial in primary biliary cirrhosis (PBC) of the liver conducted between 1974 and 1984. A total of 424 PBC patients, referred to Mayo Clinic during that ten-year interval met eligibility criteria for the randomized placebo controlled trial of the drug D-penicillamine, but only the first 312 cases in the data set participated in the randomized trial. Therefore, the data here are for the 312 patients with largely complete data.
data(pbc2)
data(pbc2)
A data frame with 1945 observations on the following 20 variables:
id
patients identifier; in total there are 312 patients.
years
number of years between registration and the earlier of death, transplantation, or study analysis time.
status
a factor with levels alive
, transplanted
and dead
.
drug
a factor with levels placebo
and
D-penicil
.
age
at registration in years.
sex
a factor with levels male
and female
.
year
number of years between enrollment and this visit date, remaining values on the line of data refer to this visit.
ascites
a factor with levels No
and Yes
.
hepatomegaly
a factor with levels No
and Yes
.
spiders
a factor with levels No
and Yes
.
edema
a factor with levels No edema
(i.e. no edema and
no diuretic therapy for edema), edema no diuretics
(i.e. edema
present without diuretics, or edema resolved by diuretics), and
edema despite diuretics
(i.e. edema despite diuretic therapy).
serBilir
serum bilirubin in mg/dl.
serChol
serum cholesterol in mg/dl.
albumin
albumin in mg/dl.
alkaline
alkaline phosphatase in U/liter.
SGOT
SGOT in U/ml.
platelets
platelets per cubic ml/1000.
prothrombin
prothrombin time in seconds.
histologic
histologic stage of disease.
status2
a numeric vector with the value 1 denoting if the patient was dead, and 0 if the patient was alive or transplanted.
Fleming T, Harrington D. Counting Processes and Survival Analysis. 1991; New York: Wiley.
Therneau T, Grambsch P. Modeling Survival Data: Extending the Cox Model. 2000; New York: Springer-Verlag.
heart.valve
, renal
,
epileptic.qol
.
dynLong
objectPlots the conditional longitudinal expectations for a
new subject calculated using the dynLong
function.
## S3 method for class 'dynLong' plot(x, main = NULL, xlab = NULL, ylab = NULL, grid = TRUE, estimator, ...)
## S3 method for class 'dynLong' plot(x, main = NULL, xlab = NULL, ylab = NULL, grid = TRUE, estimator, ...)
x |
an object of class |
main |
an overall title for the plot: see |
xlab |
a title for the x [time] axis: see |
ylab |
a character vector of the titles for the K longitudinal
outcomes y-axes: see |
grid |
adds a rectangular grid to an existing plot: see
|
estimator |
a character string that can take values |
... |
additional plotting arguments; currently limited to |
A dynamic prediction plot.
Graeme L. Hickey ([email protected])
Rizopoulos D. Dynamic predictions and prospective accuracy in joint models for longitudinal and time-to-event data. Biometrics. 2011; 67: 819–829.
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) hvd2 <- droplevels(hvd[hvd$num == 1, ]) out <- dynLong(fit2, hvd2) plot(out, main = "Patient 1") ## End(Not run)
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) hvd2 <- droplevels(hvd[hvd$num == 1, ]) out <- dynLong(fit2, hvd2) plot(out, main = "Patient 1") ## End(Not run)
dynSurv
objectPlots the conditional time-to-event distribution for a
new subject calculated using the dynSurv
function.
## S3 method for class 'dynSurv' plot( x, main = NULL, xlab = NULL, ylab1 = NULL, ylab2 = NULL, grid = TRUE, estimator, smooth = FALSE, ... )
## S3 method for class 'dynSurv' plot( x, main = NULL, xlab = NULL, ylab1 = NULL, ylab2 = NULL, grid = TRUE, estimator, smooth = FALSE, ... )
x |
an object of class |
main |
an overall title for the plot: see |
xlab |
a title for the x [time] axis: see |
ylab1 |
a character vector of the titles for the K longitudinal
outcomes y-axes: see |
ylab2 |
a title for the event-time outcome axis: see
|
grid |
adds a rectangular grid to an existing plot: see
|
estimator |
a character string that can take values |
smooth |
logical: whether to overlay a smooth survival curve (see
Details). Defaults to |
... |
additional plotting arguments; currently limited to |
The joineRML
package is based on a semi-parametric model,
such that the baseline hazards function is left unspecified. For
prediction, it might be preferable to have a smooth survival curve. Rather
than changing modelling framework a prior, a constrained B-splines
non-parametric median quantile curve is estimated using
cobs
, with a penalty function of , and
subject to constraints of monotonicity and
.
A dynamic prediction plot.
Graeme L. Hickey ([email protected])
Ng P, Maechler M. A fast and efficient implementation of qualitatively constrained quantile smoothing splines. Statistical Modelling. 2007; 7(4): 315-328.
Rizopoulos D. Dynamic predictions and prospective accuracy in joint models for longitudinal and time-to-event data. Biometrics. 2011; 67: 819–829.
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) hvd2 <- droplevels(hvd[hvd$num == 1, ]) out1 <- dynSurv(fit2, hvd2) plot(out1, main = "Patient 1") ## End(Not run) ## Not run: # Monte Carlo simulation with 95% confidence intervals on plot out2 <- dynSurv(fit2, hvd2, type = "simulated", M = 200) plot(out2, main = "Patient 1") ## End(Not run)
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) hvd2 <- droplevels(hvd[hvd$num == 1, ]) out1 <- dynSurv(fit2, hvd2) plot(out1, main = "Patient 1") ## End(Not run) ## Not run: # Monte Carlo simulation with 95% confidence intervals on plot out2 <- dynSurv(fit2, hvd2, type = "simulated", M = 200) plot(out2, main = "Patient 1") ## End(Not run)
mjoint
objectPlot diagnostics from an mjoint
object.
## S3 method for class 'mjoint' plot(x, type = "convergence", ...)
## S3 method for class 'mjoint' plot(x, type = "convergence", ...)
x |
an object inheriting from class |
type |
currently the only option is |
... |
other parameters passed to |
Graeme L. Hickey ([email protected])
# Fit a classical univariate joint model with a single longitudinal outcome # and a single time-to-event outcome data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] set.seed(1) fit1 <- mjoint(formLongFixed = log.lvmi ~ time + age, formLongRandom = ~ time | num, formSurv = Surv(fuyrs, status) ~ age, data = hvd, timeVar = "time", control = list(nMCscale = 2, burnin = 5)) # controls for illustration only plot(fit1, param = "beta") # LMM fixed effect parameters plot(fit1, param = "gamma") # event model parameters ## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", control = list(burnin = 50), verbose = TRUE) plot(fit2, type = "convergence", params = "gamma") ## End(Not run)
# Fit a classical univariate joint model with a single longitudinal outcome # and a single time-to-event outcome data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] set.seed(1) fit1 <- mjoint(formLongFixed = log.lvmi ~ time + age, formLongRandom = ~ time | num, formSurv = Surv(fuyrs, status) ~ age, data = hvd, timeVar = "time", control = list(nMCscale = 2, burnin = 5)) # controls for illustration only plot(fit1, param = "beta") # LMM fixed effect parameters plot(fit1, param = "gamma") # event model parameters ## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", control = list(burnin = 50), verbose = TRUE) plot(fit2, type = "convergence", params = "gamma") ## End(Not run)
ranef.mjoint
objectDisplays a plot of the BLUPs and approximate 95% prediction interval for each subject.
## S3 method for class 'ranef.mjoint' plot(x, ...)
## S3 method for class 'ranef.mjoint' plot(x, ...)
x |
an object inheriting from class |
... |
additional arguments; currently none are used. |
an object inheriting from class ggplot
, which displays a
trellis plot with a separate panel for each effect, showing a dotplot (with
optional error bars indicating approximate 95% prediction intervals if the
argument postVar=TRUE
is set in the call to ranef
) for
each subject (by row).
Graeme L. Hickey ([email protected])
Pinheiro JC, Bates DM. Mixed-Effects Models in S and S-PLUS. New York: Springer Verlag; 2000.
## Not run: require(ggplot2) data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] set.seed(1) fit1 <- mjoint(formLongFixed = log.lvmi ~ time, formLongRandom = ~ time | num, formSurv = Surv(fuyrs, status) ~ 1, data = hvd, timeVar = "time") plot(ranef(fit1, postVar = TRUE)) ## End(Not run)
## Not run: require(ggplot2) data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] set.seed(1) fit1 <- mjoint(formLongFixed = log.lvmi ~ time, formLongRandom = ~ time | num, formSurv = Surv(fuyrs, status) ~ 1, data = hvd, timeVar = "time") plot(ranef(fit1, postVar = TRUE)) ## End(Not run)
mjoint
objectPlot convergence time series for parameter vectors from an
mjoint
object.
plotConvergence(object, params = "gamma", discard = FALSE)
plotConvergence(object, params = "gamma", discard = FALSE)
object |
an object inheriting from class |
params |
a string indicating what parameters are to be shown. Options
are |
discard |
logical; if |
Graeme L. Hickey ([email protected])
Wei GC, Tanner MA. A Monte Carlo implementation of the EM algorithm and the poor man's data augmentation algorithms. J Am Stat Assoc. 1990; 85(411): 699-704.
plot.mjoint
, plot.default
,
par
, abline
.
mjoint
objectExtract random effects estimates from an mjoint
object.
## S3 method for class 'mjoint' ranef(object, postVar = FALSE, ...)
## S3 method for class 'mjoint' ranef(object, postVar = FALSE, ...)
object |
an object inheriting from class |
postVar |
logical: if |
... |
additional arguments; currently none are used. |
A data.frame
(also of class ranef.mjoint
) with rows
denoting the individuals and columns the random effects (e.g., intercepts,
slopes, etc.). If postVar=TRUE
, the numeric matrix has an extra
attribute, postVar
.
Graeme L. Hickey ([email protected])
Pinheiro JC, Bates DM. Mixed-Effects Models in S and S-PLUS. New York: Springer Verlag; 2000.
Wulfsohn MS, Tsiatis AA. A joint model for survival and longitudinal data measured with error. Biometrics. 1997; 53(1): 330-339.
ranef
for the generic method description, and
fixef.mjoint
. To plot ranef.mjoint
objects, see
plot.ranef.mjoint
.
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) ranef(fit2) ## End(Not run)
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) ranef(fit2) ## End(Not run)
This is a dataset on 407 patients suffering from chronic kidney disease who underwent a primary renal transplantation with a graft from a deceased or living donor in the University Hospital of the Catholic University of Leuven (Belgium) between 21 January 1983 and 16 August 2000. Chronic kidney (renal) disease is a progressive loss of renal function over a period of months or years through five stages. Each stage is a progression through an abnormally low and progressively worse glomerular filtration rate (GFR). The dataset records 3 repeated measures (2 continuous and 1 binary), and an event time.
data(renal)
data(renal)
This is a list with 4 data frames:
prot
: repeated measurement data for proteinuria (binary) that
measures whether the kidneys succeed in sustaining the proteins in the
blood and not discard them in the urine.
haem
: repeated measurement data for blood haematocrit level
(continuous) that measures whether the kidneys produce adequate amounts of
the hormone erythropoietin that regulates the red blood cell production.
gfr
: repeated measurement data for GFR (continuous) that
measures the filtration rate of the kidneys.
surv
: time-to-event data for renal graft failure.
All datasets have the common data columns, which are in long format for the 3 longitudinal data data frames, and 1-per-subject for the time-to-event data frame:
id
number for patient identification.
age
age of patient at day of surgery (years).
weight
preoperative weight of patient (kg).
sex
gender of patient.
fuyears
maximum follow up time, with transplant date as the time origin (years).
failure
censoring indicator (1=
graft failure and
0=
censored).
The longitudinal datasets only contain 2 further columns:
time
observed time point, with surgery date as the time origin (years).
a recorded measurement of the biomarker taken at
time time
. The 3 biomarkers (one per data frame) are:
proteinuria
: recorded as binary indicator: present or
not-present. Present in the prot
data.
haematocrit
: recorded as percentage (%) of the ratio of the
volume of red blood cells to the total volume of blood. Present in the
haem
data.
gfr
: measured as ml/min/1.73. Present in the
gfr
data.
Dr Dimitris Rizopoulos ([email protected]).
Rizopoulos D, Ghosh, P. A Bayesian semiparametric multivariate joint model for multiple longitudinal outcomes and a time-to-event. Stat Med. 2011; 30(12): 1366-80.
pbc2
, heart.valve
,
epileptic.qol
.
mjoint
residualsThe residuals at level i are obtained by subtracting the fitted levels at that level from the response vector.
## S3 method for class 'mjoint' residuals(object, level = 0, ...)
## S3 method for class 'mjoint' residuals(object, level = 0, ...)
object |
an object inheriting from class |
level |
an optional integer giving the level of grouping to be used in
extracting the residuals from object. Level values increase from outermost
to innermost grouping, with level 0 corresponding to the population
residuals and level 1 corresponding to subject-specific residuals. Defaults
to |
... |
additional arguments; currently none are used. |
A list
of length K with each element a vector of
residuals for the k-th longitudinal outcome.
Graeme L. Hickey ([email protected])
Pinheiro JC, Bates DM. Mixed-Effects Models in S and S-PLUS. New York: Springer Verlag; 2000.
mjoint
objectGeneric function used to sample a subset of data from an object
of class mjoint
with a specific number of subjects.
sampleData(object, size = NULL, replace = TRUE)
sampleData(object, size = NULL, replace = TRUE)
object |
an object inheriting from class |
size |
number of subjects to include in the sampled subset. If
|
replace |
use replacement when sampling subjects? Default is
|
This function is primarily intended for internal use in the
bootSE
function in order to permit bootstrapping. However, it
can be used for other purposes given a fitted mjoint
object.
A list of 2 data.frames: one recording the requisite longitudinal outcomes data, and the other recording the time-to-event data.
Graeme L. Hickey ([email protected])
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) sampleData(fit2, size = 10) ## End(Not run)
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) sampleData(fit2, size = 10) ## End(Not run)
mjoint
objectExtract residual standard deviation(s) from an mjoint
object.
## S3 method for class 'mjoint' sigma(object, ...)
## S3 method for class 'mjoint' sigma(object, ...)
object |
an object inheriting from class |
... |
additional arguments; currently none are used. |
a number (standard deviation) if (univariate model), or a
vector if
(multivariate model).
Graeme L. Hickey ([email protected])
Pinheiro JC, Bates DM. Mixed-Effects Models in S and S-PLUS. New York: Springer Verlag; 2000.
sigma
in the lme4 package.
This function simulates multivariate longitudinal and time-to-event data from a joint model.
simData( n = 100, ntms = 5, beta = rbind(c(1, 1, 1, 1), c(1, 1, 1, 1)), gamma.x = c(1, 1), gamma.y = c(0.5, -1), sigma2 = c(1, 1), D = NULL, df = Inf, model = "intslope", theta0 = -3, theta1 = 1, censoring = TRUE, censlam = exp(-3), truncation = TRUE, trunctime = (ntms - 1) + 0.1 )
simData( n = 100, ntms = 5, beta = rbind(c(1, 1, 1, 1), c(1, 1, 1, 1)), gamma.x = c(1, 1), gamma.y = c(0.5, -1), sigma2 = c(1, 1), D = NULL, df = Inf, model = "intslope", theta0 = -3, theta1 = 1, censoring = TRUE, censlam = exp(-3), truncation = TRUE, trunctime = (ntms - 1) + 0.1 )
n |
the number of subjects to simulate data for. |
ntms |
the maximum number of (discrete) time points to simulate repeated longitudinal measurements at. |
beta |
a matrix of |
gamma.x |
a vector of |
gamma.y |
a vector of |
sigma2 |
a vector of |
D |
a positive-definite matrix specifying the variance-covariance
matrix. If |
df |
a non-negative scalar specifying the degrees of freedom for the
random effects if sampled from a multivariate t-distribution. The
default is |
model |
follows the model definition in the |
theta0 , theta1
|
parameters controlling the failure rate. See Details. |
censoring |
logical: if |
censlam |
a scale ( |
truncation |
logical: if |
trunctime |
a truncation time for use when |
The function simData
simulates data from a joint model,
similar to that performed in Henderson et al. (2000). It works by first
simulating multivariate longitudinal data for all possible follow-up times
using random draws for the multivariate Gaussian random effects and
residual error terms. Data can be simulated assuming either
random-intercepts only in each of the longitudinal sub-models, or
random-intercepts and random-slopes. Currently, all models must have the
same structure. The failure times are simulated from proportional hazards
time-to-event models using the following methodologies:
model="int"
The baseline hazard function is specified to be an exponential distribution with
Simulation is conditional on known time-independent effects, and the methodology of Bender et al. (2005) is used to simulate the failure time.
model="intslope"
The baseline hazard function is specified to be a Gompertz distribution with
In the usual representation of the Gompertz distribution, is
the shape parameter, and the scale parameter is equivalent to
. Simulation is conditional on on a predictable
(linear) time-varying process, and the methodology of Austin (2012) is used
to simulate the failure time.
A list of 2 data.frame
s: one recording the requisite
longitudinal outcomes data, and one recording the time-to-event data.
Pete Philipson ([email protected]) and Graeme L. Hickey ([email protected])
Austin PC. Generating survival times to simulate Cox proportional hazards models with time-varying covariates. Stat Med. 2012; 31(29): 3946-3958.
Bender R, Augustin T, Blettner M. Generating survival times to simulate Cox proportional hazards models. Stat Med. 2005; 24: 1713-1723.
Henderson R, Diggle PJ, Dobson A. Joint modelling of longitudinal measurements and event time data. Biostatistics. 2000; 1(4): 465-480.
beta <- rbind(c(0.5, 2, 1, 1), c(2, 2, -0.5, -1)) D <- diag(4) D[1, 1] <- D[3, 3] <- 0.5 D[1, 2] <- D[2, 1] <- D[3, 4] <- D[4, 3] <- 0.1 D[1, 3] <- D[3, 1] <- 0.01 sim <- simData(n = 250, beta = beta, D = D, sigma2 = c(0.25, 0.25), censlam = exp(-0.2), gamma.y = c(-.2, 1), ntms = 8)
beta <- rbind(c(0.5, 2, 1, 1), c(2, 2, -0.5, -1)) D <- diag(4) D[1, 1] <- D[3, 3] <- 0.5 D[1, 2] <- D[2, 1] <- D[3, 4] <- D[4, 3] <- 0.1 D[1, 3] <- D[3, 1] <- 0.01 sim <- simData(n = 250, beta = beta, D = D, sigma2 = c(0.25, 0.25), censlam = exp(-0.2), gamma.y = c(-.2, 1), ntms = 8)
mjoint
objectThis function provides a summary of an mjoint
object.
## S3 method for class 'mjoint' summary(object, bootSE = NULL, ...)
## S3 method for class 'mjoint' summary(object, bootSE = NULL, ...)
object |
an object inheriting from class |
bootSE |
an object inheriting from class |
... |
additional arguments; currently none are used. |
A list containing the coefficient matrices for the longitudinal and time-to-event sub-models; variance-covariance matrix for the random effects; residual error variances; log-likelihood of joint model; AIC and BIC statistics; and model fit objects.
Graeme L. Hickey ([email protected])
Wulfsohn MS, Tsiatis AA. A joint model for survival and longitudinal data measured with error. Biometrics. 1997; 53(1): 330-339.
Henderson R, Diggle PJ, Dobson A. Joint modelling of longitudinal measurements and event time data. Biostatistics. 2000; 1(4): 465-480.
Lin H, McCulloch CE, Mayne ST. Maximum likelihood estimation in the joint analysis of time-to-event and multiple longitudinal variables. Stat Med. 2002; 21: 2369-2382.
mjoint
, mjoint.object
, and
summary
for the generic method description.
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) summary(fit2) ## End(Not run)
## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) summary(fit2) ## End(Not run)
mjoint
objectReturns the variance-covariance matrix of the main parameters of
a fitted mjoint
model object.
## S3 method for class 'mjoint' vcov(object, correlation = FALSE, ...)
## S3 method for class 'mjoint' vcov(object, correlation = FALSE, ...)
object |
an object inheriting from class |
correlation |
logical: if |
... |
additional arguments; currently none are used. |
This is a generic function that extracts the variance-covariance
matrix of parameters from an mjoint
model fit. It is based on a
profile likelihood, so no estimates are given for the baseline hazard
function, which is generally considered a nuisance parameter. It is based
on the empirical information matrix (see Lin et al. 2002, and McLachlan
and Krishnan 2008 for details), so is only approximate.
A variance-covariance matrix.
This function is not to be confused with getVarCov
, which
returns the extracted variance-covariance matrix for the random effects
distribution.
Graeme L. Hickey ([email protected])
Lin H, McCulloch CE, Mayne ST. Maximum likelihood estimation in the joint analysis of time-to-event and multiple longitudinal variables. Stat Med. 2002; 21: 2369-2382.
McLachlan GJ, Krishnan T. The EM Algorithm and Extensions. Second Edition. Wiley-Interscience; 2008.
vcov
for the generic method description, and
cov2cor
for details of efficient scaling of a
covariance matrix into the corresponding correlation matrix.
# Fit a classical univariate joint model with a single longitudinal outcome # and a single time-to-event outcome data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] set.seed(1) fit1 <- mjoint(formLongFixed = log.lvmi ~ time + age, formLongRandom = ~ time | num, formSurv = Surv(fuyrs, status) ~ age, data = hvd, timeVar = "time", control = list(nMCscale = 2, burnin = 5)) # controls for illustration only vcov(fit1) ## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) vcov(fit2) ## End(Not run)
# Fit a classical univariate joint model with a single longitudinal outcome # and a single time-to-event outcome data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] set.seed(1) fit1 <- mjoint(formLongFixed = log.lvmi ~ time + age, formLongRandom = ~ time | num, formSurv = Surv(fuyrs, status) ~ age, data = hvd, timeVar = "time", control = list(nMCscale = 2, burnin = 5)) # controls for illustration only vcov(fit1) ## Not run: # Fit a joint model with bivariate longitudinal outcomes data(heart.valve) hvd <- heart.valve[!is.na(heart.valve$log.grad) & !is.na(heart.valve$log.lvmi), ] fit2 <- mjoint( formLongFixed = list("grad" = log.grad ~ time + sex + hs, "lvmi" = log.lvmi ~ time + sex), formLongRandom = list("grad" = ~ 1 | num, "lvmi" = ~ time | num), formSurv = Surv(fuyrs, status) ~ age, data = list(hvd, hvd), inits = list("gamma" = c(0.11, 1.51, 0.80)), timeVar = "time", verbose = TRUE) vcov(fit2) ## End(Not run)