knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(JMP)
As an emerging clinical specialty, palliative care involves multiple sectors such as medicine, nursing, social work, and volunteering. Palliative care emphasizes more on relieving the suffering of patients due to the advanced disease status. The knowledge of terminal trend of quality of life (QOL) becomes an important tool to allow practitioners to provide care in a better and more efficient way. To determine the efficacy of a new palliative care treatment, analyses regarding longitudinal measurements of QOL are at greater interests than survival outcomes. However, statistical challenges are present in analyzing palliative care data as QOL decreases as patients approach the end of life. Such correlation between longitudinal QOL and survival outcomes promotes us to model them jointly in order to offer accurate interpretation and estimations.
In the paper (see reference [1]), we propose a semiparametric terminal trend model with the following two sub-models:
a semiparametric mixed effects sub-model for the longitudinal QOL (only random intercept is used in this package)
$$Y_i(t^)=\beta_\mu(t^)+A_i\beta_A(t^)+X_i^T\psi_X+b_i+\epsilon_i(t^)$$
where $\beta_\mu(t^)$ denotes the mean trajectory in the control group and the $\beta_A(t^)$ denotes the time-varying treatment effect at time $t^$ counting backward from the time of death. The unspecified smooth functions $\beta_\mu(t^)$ and $\beta_A(t^)$ are determined by nonparametric curve through regression spline methods with natural cubic B-splines. The $\psi_X$ is the p-dimensional vector of fixed effect parameters associated with the baseline covariate vector $X_i$ adjusted in the model, and $b_i$ is the subject-specific random intercept term. The $\epsilon_i(t^)$ is the normally distributed residual error.
a cox sub-model for the survival outcomes
$$\lambda_i(t)=\lambda_0(t)exp(A_i\alpha_A+\tilde{X}_i^T\alpha_X)$$
where t denote the time since enrollment on the prospective time scale, and $\alpha_X$ denote the Q-dimensional parameters associated with the Q-dimensional baseline covariates $\tilde{X_i}$.
The R package "JMP" was aim to offer a implementation of the analyses for palliative care clinical trials from the perspective of joint modeling.
The package "JMP" consists of a main function, JMP, that is calling other sub-functions in order to implement the joint model proposed. Firstly, we can install the package from Github.
require(devtools) devtools::install_github("https://github.com/gitlzg/JMP", build_vignettes = TRUE) library(JMP)
The main function JMP is the actual function that will be applied by users. Users need to supply arguments of
The final return elements from the JMP function are the following:
A list of analysis results
monthly QOL results for each treatment group
and
Four figures saved in the current working directory
estimated terminal trend in a png file called "Longitudinal_trajectories.png"
An example dataset, "dat_JMP", is included in the package. A total of 118 observations and 36 variables are saved in the "dat_JMP" data frame with the data dictionary:
To access the example dataset, simply type:
data(dat_JMP)
We will demonstrate the JMP function on the example dataset. To adjust for variables "sex" and baseline QOL "qol_0", we fill in the covariates.fields by them. Other arguments are also filled in by the corresponding variable names in the dataset.
results <- JMP(dat=dat_JMP, covariate.fields = c("sex", "qol_0"), qol.prefix="qol_", qol.time.prefix="time_", id.field = "id", survival.time.field = "survival_time", censoring.status.field = "death", treatment.status.field = "trt")
The first element in the results list is the monthly QOL results:
results$monthlyResults
Secondly, the overall p value for testing the entire model is shown.
results$overallPvalueModel
The third element is the knots combination (range specified by a input argument) with their corresponding AIC and BIC values.
results$knot.combinations
The last element "mle" is a list with all results from maximum likelihood estimations and confidence intervals.
results$mle
Additionally, to provide visualizations on the longitudinal and survival trend, four plots are generated and saved in the user's current R working directory.
[1] Li Z, Frost HR, Tosteson TD, et al. A Semiparametric Joint Model for Terminal Trend of Quality of Life and Survival in Palliative Care Research. Statistics in Medicine. 2017;36:4692–4704. https://doi.org/10.1002/sim.7445
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.