Dynamic modelling of events in patients with heart failure and reduced ejection fraction using adherence to recommended drugs as time-dependent variables
Creators: name: Insausti, Asier
name: Garmendia, Inés
name: Goretty Trujillo, Tamy
name: Librero, Julián
name: Tamayo, Ibai
name: Millán, Eduardo
Publisher: name: Zenodo
Year: 2024
Subjects: subject: joint-model
subject: survival model
subject: heart failure
subject: Mathematical model
subject: cox model
subject: Medical and health sciences
subject: FOS: Medical and health sciences
subject: Syntetic data
subject: Health care services

description: Welcome to the repository! This repository aims to share with the community the code used to develop a real use case of survival joint modeling models programmed with R (version 4.3.3). The real use case will be published soon.

This product is part of a research project initiative that was born under the umbrella of REDISSEC, the Spanish Research Network on Health Services Research and Chronic Conditions [www.redissec.com], and which continues under RICAPPS the Spanish Research Network on Chronicity, Primary Care, and Health Promotion [www.ricapps.es].



Overview


The code of the repository was used to build predictive dynamic predictive models (multivariate survival joint models) on a retrospective cohort that included patients with heart failure (HF) and reduced ejection fraction (rEF). The primary outcome was a composite of death or a first hospital admission for HF, whichever occurred first, in a 12-month follow-up period. Adherence to recommended drugs were used as time-dependent variables (longiudinal variables) in the model.

The original dataset is a retrospective cohort that included patients assigned to one of the IHOs that have a reference hospital belonging to the Basque public hospital network. However, for this repository a synthetic dataset with similar features was created.

Joint models for longitudinal and time-to-event data constitute an attractive modeling paradigm that currently enjoys great interest in the statistics and medical literature. These models are utilized in follow-up studies where interest is in associating a longitudinal response with an event time outcome. In this work, the popular package JMBayes2 was used to build the models.

JM consists of two sub-models: a longitudinal and a time-to-event process. To accommodate different types of longitudinal responses in a unified framework, generalized linear mixed effects model are used. In this work, longitudinal outcome was modeled with cubic splines in both the fixed and random effects to properly account for nonlinearity. Furthermore, two types of association structure between the longitudinal and survival processes were explored. On the one hand, the hazard for an event at any time t was associated with the current underlying value of the cumulative adherence at the same time point. On the other hand, the hazard was associated with both the current true value of the trajectory and its slope at time t.



Components


The code is structured with all necessary code blocks to build an end-to-end project of joint models.



Dataset builder to develop joint models with longitudinal data (dfjm_builder.R).

Descriptive analysis of the dataset to analyse the behaviour of patients (descriptive.R).

Development of multivariant joint models (modelling_jm.R, modelling_mv_jm.R, modelling_cox.R).

Validation scripts: Performance metrics (AUC, precision) for joint_models (performance_metrics/) and goodness of fir for mixed effect models (validation_mixeffectmodels.R).

Graphs to make dynamic predictions (predictions_jm.R).




Set up


First, open joint_model.Rproj. Open other scripts always inside the project joint_model.Rproj.

Second, you need to active the environment manage by renv package. Install it and call renv::restore() to install the specific package versions needed to execute the code. Note: You may need to install Rtools 4.3 too in order to avoid some errors related to the installation of some packages. If renv::restore() does not work for you, install the packages by hand.

Now you are ready to start using the code of the repository. In order to use any script of the repository, first you need to create the dataset to develop joint models with longitudinal data. To do this, you need to execute the script dfjm_builder.R. After creating the dataset, it is possible to execute all the scripts except predictions_jm.R. In order to run predictions_jm.R you need to create a joint model. This can be achieve by running either modelling_mv_jm.R or modelling_jm.R.

The code was tested in R version 4.3.3.