Joint Models for Longitudinal and Time-to-Event Data
Fits multivariate joint models for longitudinal and time-to-event data.
jm(Surv_object, Mixed_objects, time_var, functional_forms = NULL, data_Surv = NULL, id_var = NULL, priors = NULL, control = NULL, ...) value(x) slope(x, eps = 0.001, direction = "both") area(x) vexpit(x) Dexpit(x) vexp(x) Dexp(x) vlog(x) vlog2(x) vlog10(x) vsqrt(x) tv(x, knots = NULL, ord = 2L)
Surv_object |
an object:
|
Mixed_objects |
a
|
time_var |
a |
functional_forms |
a |
data_Surv |
the |
id_var |
a |
priors |
a named
|
control |
a list of control values with components:
|
x |
a numeric input variable. |
knots |
a numeric vector of knots. |
ord |
an integer denoting the order of the spline. |
eps |
numeric scalar denoting the step-size for the finite difference approximation. |
direction |
character string for the direction of the numerical derivative, options are |
... |
arguments passed to |
The mathematical details regarding the definition of the multivariate joint model, and the capabilities of the package can be found in the vignette in the doc directory.
A list of class jm
with components:
mcmc |
a |
acc_rates |
a |
logLik |
a |
mlogLik |
a |
running_time |
an object of class |
statistics |
a |
fit_stats |
a |
model_data |
a |
model_info |
a |
initial_values |
a |
control |
a copy of the |
priors |
a copy of the |
call |
the matched call. |
Dimitris Rizopoulos d.rizopoulos@erasmusmc.nl
################################################################################ ############################################## # Univariate joint model for serum bilirubin # # 1 continuous outcome # ############################################## # [1] Fit the mixed model using lme(). fm1 <- lme(fixed = log(serBilir) ~ year * sex + I(year^2) + age + prothrombin, random = ~ year | id, data = pbc2) # [2] Fit a Cox model, specifying the baseline covariates to be included in the # joint model. fCox1 <- coxph(Surv(years, status2) ~ drug + age, data = pbc2.id) # [3] The basic joint model is fitted using a call to jm() i.e., joint_model_fit_1 <- jm(fCox1, fm1, time_var = "year", n_chains = 1L, n_iter = 11000L, n_burnin = 1000L) summary(joint_model_fit_1) traceplot(joint_model_fit_1) ################################################################################ ########################################################################## # Multivariate joint model for serum bilirubin, hepatomegaly and ascites # # 1 continuous outcome, 2 categorical outcomes # ########################################################################## # [1] Fit the mixed-effects models using lme() for continuous # outcomes and mixed_model() for categorical outcomes. fm1 <- lme(fixed = log(serBilir) ~ year * sex, random = ~ year | id, data = pbc2) fm2 <- mixed_model(hepatomegaly ~ sex + age + year, data = pbc2, random = ~ year | id, family = binomial()) fm3 <- mixed_model(ascites ~ year + age, data = pbc2, random = ~ year | id, family = binomial()) # [2] Save all the fitted mixed-effects models in a list. Mixed <- list(fm1, fm2, fm3) # [3] Fit a Cox model, specifying the baseline covariates to be included in the # joint model. fCox1 <- coxph(Surv(years, status2) ~ drug + age, data = pbc2.id) # [4] The joint model is fitted using a call to jm() i.e., joint_model_fit_2 <- jm(fCox1, Mixed, time_var = "year", n_chains = 1L, n_iter = 11000L, n_burnin = 1000L) summary(joint_model_fit_2) traceplot(joint_model_fit_2) ################################################################################ ###################### # Slope & Area Terms # ###################### # We extend model 'joint_model_fit_2' by including the value and slope term for # bilirubin, the area term for hepatomegaly (in the log-odds scale), and the # value and area term for spiders (in the log-odds scale). # To include these terms into the model, we specify the 'functional_forms' # argument. This should be a list of right side formulas. Each component of the # list should have as name the name of the corresponding outcome variable. In # the right side formula we specify the functional form of the association using # functions 'value()', 'slope()' and 'area()'. # Notes: (1) For terms not specified in the 'functional_forms' list, the default # value functional form is used. # [1] Fit the mixed-effects models using lme() for continuous outcomes # and mixed_model() for categorical outcomes. fm1 <- lme(fixed = log(serBilir) ~ year * sex, random = ~ year | id, data = pbc2) fm2 <- mixed_model(hepatomegaly ~ sex + age + year, data = pbc2, random = ~ year | id, family = binomial()) fm3 <- mixed_model(ascites ~ year + age, data = pbc2, random = ~ year | id, family = binomial()) # [2] Save all the fitted mixed-effects models in a list. Mixed <- list(fm1, fm2, fm3) # [3] Fit a Cox model, specifying the baseline covariates to be included in the # joint model. fCox1 <- coxph(Surv(years, status2) ~ drug + age, data = pbc2.id) # [4] Specify the list of formulas to be passed to the functional_forms argument # of jm(). fForms <- list("log(serBilir)" = ~ value(log(serBilir)) + slope(log(serBilir)), "hepatomegaly" = ~ area(hepatomegaly), "ascites" = ~ value(ascites) + area(ascites)) # [5] The joint model is fitted using a call to jm() and passing the list # to the functional_forms argument. joint_model_fit_2 <- jm(fCox1, Mixed, time_var = "year", functional_forms = fForms, n_chains = 1L, n_iter = 11000L, n_burnin = 1000L) summary(joint_model_fit_2)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.