jm Methods  R Documentation 
Methods for object of class "jm"
for standard generic functions.
coef(object, ...)
## S3 method for class 'jm'
coef(object, ...)
fixef(object, ...)
## S3 method for class 'jm'
fixef(object, outcome = Inf, ...)
ranef(object, ...)
## S3 method for class 'jm'
ranef(object, outcome = Inf, post_vars = FALSE, ...)
terms(x, ...)
## S3 method for class 'jm'
terms(x, process = c("longitudinal", "event"),
type = c("fixed", "random"), ...)
model.frame(formula, ...)
## S3 method for class 'jm'
model.frame(formula, process = c("longitudinal", "event"),
type = c("fixed", "random"), ...)
model.matrix(object, ...)
## S3 method for class 'jm'
model.matrix(object, ...)
family(object, ...)
## S3 method for class 'jm'
family(object, ...)
compare_jm(..., type = c("marginal", "conditional"),
order = c("WAIC", "DIC", "LPML", "none"))
object, x, formula 
object inheriting from class 
outcome 
the index of the linear mixed submodel to extract the estimated fixed effects. If greater than the total number of submodels, extracts from all of them. 
post_vars 
logical; if 
process 
which submodel(s) to extract the terms:

type 
in
in

... 
further arguments; currently, none is used. 
order 
which criteria use to sort the models in the output. 
coef()
Extracts estimated fixed effects for the event process from a fitted joint model.
fixef()
Extracts estimated fixed effects for the longitudinal processes from a fitted joint model.
ranef()
Extracts estimated random effects from a fitted joint model.
terms()
Extracts the terms object(s) from a fitted joint model.
model.frame()
Creates the model frame from a fitted joint model.
model.matrix()
Creates the design matrices for linear mixed submodels from a fitted joint model.
family()
Extracts the error distribution and link function used in the linear mixed submodel(s) from a fitted joint model.
compare_jm()
Compares two or more fitted joint models using the criteria WAIC, DIC, and LPML.
coef()
a list with the elements:
gammas
: estimated baseline fixed effects, and
association
: estimated association parameters.
fixef()
a numeric vector of the estimated fixed effects for the outcome
selected. If the outcome
is greater than the number of linear mixed submodels, it returns a list of numeric vectors for all outcomes.
ranef()
a numeric matrix with rows denoting the individuals and columns the random effects. If postVar = TRUE
, the numeric matrix has the extra attribute "postVar".
terms()
if process = "longitudinal"
, a list of the terms object(s) for the linear mixed model(s).
if process = "event"
, the terms object for the survival model.
model.frame()
if process = "longitudinal"
, a list of the model frames used in the linear mixed model(s).
if process = "event"
, the model frame used in the survival model.
model.matrix()
a list of the design matrix(ces) for the linear mixed submodel(s).
family()
a list of family
objects.
compare_jm()
a list with the elements:
table
: a table with the criteria calculated for each joint model, and
type
: the loglikelihood function used to calculate the criteria.
Dimitris Rizopoulos d.rizopoulos@erasmusmc.nl
jm
# linear mixed model fits
fit_lme1 < lme(log(serBilir) ~ year:sex + age,
random = ~ year  id, data = pbc2)
fit_lme2 < lme(prothrombin ~ sex,
random = ~ year  id, data = pbc2)
# cox model fit
fit_cox < coxph(Surv(years, status2) ~ age, data = pbc2.id)
# joint model fit
fit_jm < jm(fit_cox, list(fit_lme1, fit_lme2), time_var = "year",
n_chains = 1L, n_iter = 11000L, n_burnin = 1000L)
# coef(): fixed effects for the event process
coef(fit_jm)
# fixef(): fixed effects for the first linear mixed submodel
fixef(fit_jm, outcome = 1)
# ranef(): random effects from all linear mixed submodels
head(ranef(fit_jm))
# terms(): random effects terms for the first linear mixed submodel
terms(fit_jm, process = "longitudinal", type = "random")[[1]]
# mode.frame(): model frame for the fixed effects in the second
# linear mixed submodel
head(model.frame(fit_jm, process = "longitudinal", type = "fixed")[[2]])
# model.matrix(): fixed effects design matrix for the first linear
# mixed submodel
head(model.matrix(fit_jm)[[1]])
# family(): family objects from both linear mixed submodels
family(fit_jm)
# compare_jm(): compare two fitted joint models
fit_lme1b < lme(log(serBilir) ~ 1,
random = ~ year  id, data = pbc2)
fit_jm2 < jm(fit_cox, list(fit_lme1b, fit_lme2), time_var = "year",
n_chains = 1L, n_iter = 11000L, n_burnin = 1000L)
compare_jm(fit_jm, fit_jm2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.