Combining survival analysis with mixed models is a powerful approach for analyzing time-to-event data that also accounts for the variation within and between groups or clusters (e.g., patients within hospitals, observations over time with repeated measures). This combination is particularly useful for handling correlated data, such as in longitudinal studies or when there are random effects to be considered alongside the survival outcomes.
Model Name:
The model that combines elements of survival analysis with mixed effects modeling is commonly referred to as a Mixed Effects Survival Model or more specifically:
Frailty Model (when the random effect is interpreted as a frailty, representing unobserved heterogeneity in the hazard rate among groups or individuals). Frailty models are particularly useful when analyzing clustered data (e.g., family members, paired organs) where the goal is to account for the correlation between subjects within the same group.
Shared Frailty Model (extends the frailty model by accounting for the correlation between subjects in the same group, such as family members or paired organs).
Joint Model (implies a model that jointly analyzes a longitudinal outcome and a time-to-event outcome, and it can also incorporate mixed effects for either or both outcomes). Joint models are essential when the longitudinal measurements and survival outcome are associated, and the goal is to model both processes simultaneously.
R Functions:
Several R packages and functions can be used to fit such models, depending on the specific structure of your data and the desired model specifications. Here are a few notable ones:
coxme Package:
Function:coxme()
Description: Fits mixed-effects Cox models. Useful for including random effects in a Cox proportional hazards model to account for clustering or variation at the group level.
Use Case: Ideal for studies where the focus is on estimating the effects of predictors on the hazard rate while accounting for group-level variation.
survival Package with frailty Argument:
Function:coxph() with frailty() term
Description: Incorporates a frailty term into a Cox model to account for clustering, particularly useful for modeling unobserved heterogeneity.
Use Case: Suitable for analyzing data with clustered structures, such as patients within hospitals, where the clustering affects the hazard rate.
JM Package:
Function:jm()
Description: Primarily for joint models of longitudinal and survival data, but can incorporate mixed effects for handling correlations between longitudinal measurements and time-to-event outcomes.
Use Case: Essential in studies where both longitudinal data (e.g., repeated measurements of a biomarker) and survival data are observed, and there is a need to model their association.
glmmADMB Package (for more complex generalized linear mixed models, including survival outcomes with specific distributions):
Function:glmmadmb()
Description: Offers flexibility for modeling, including survival analysis with mixed effects, though it might require more specification from the user. It is particularly useful for modeling non-standard distributions.
Use Case: Applicable when the survival data do not follow the typical assumptions of proportional hazards, and alternative distributions (e.g., Weibull) are needed.
coxph() with cluster() from survival Package for Clustered Data:
While not a full mixed model, using cluster() within coxph() adjusts standard errors for clustering, a simpler approach when random effects aren’t the primary focus.
Use Case: Useful for preliminary analyses or when the research question focuses on adjusting for clustering without explicitly modeling random effects.
Example Usage:
To give you a starting point, here are examples using coxme for a mixed-effects Cox model and jm for a joint model:
r
# Example 1: Mixed-Effects Cox Model using coxme
# Assuming 'library(coxme)' has been run
# and 'mydata' is your dataframe with
# 'Surv(time, event)' as survival outcome,
# 'predictor' as a fixed effect, and
# 'cluster' as the grouping variable for the random effect
model_coxme <- coxme(Surv(time, event) ~ predictor + frailty(cluster), data = mydata)
summary(model_coxme)
# Example 2: Joint Model using JM package
# Assuming 'library(JM)' has been run
# and 'mydata_long' is your dataframe with longitudinal measurements,
# 'mydata_surv' is your dataframe with survival data,
# 'longitudinal_outcome ~ predictor' models the longitudinal process, and
# 'Surv(surv_time, surv_event) ~ surv_predictor' models the survival process
model_jm <- jm(Surv(surv_time, surv_event) ~ surv_predictor,
longitudinal_outcome ~ predictor,
timevar = "observation_time",
id = "subject_id",
data = list(mydata_surv, mydata_long))
summary(model_jm)
Advice:
Always check the assumptions of the chosen model (e.g., proportional hazards for Cox models).
Explore your data to decide which package/function best suits your analysis needs. For instance, if you have longitudinal measurements closely tied to the survival outcome, a joint model might be more appropriate.
Consult the documentation and vignettes of the chosen package for detailed examples and guidance. Many packages include vignettes that demonstrate how to prepare data, fit models, and interpret results.
Be mindful of model complexity and computational demands, especially with large datasets or complex models like joint models.