A Framework for the Estimation of Quality Adjusted Life Years Using Joint Models of Longitudinal and Survival Data
This repository includes example data and code supporting the manuscript titled “A Framework for the Estimation of Quality Adjusted Life Years Using Joint Models of Longitudinal and Survival Data”.
This analysis is based on a simulated dataset to ensure that it can be
shared freely and without any restriction. The data-generating mechanism
is described below, and the Stata code implementing the simulation is
included in this repository, in the file named
01-simulate-data.do.
The dataset is included in the
data
folder, and can be downloaded
here.
Note that a .pdf version of this README file can be downloaded
here,
and that all code included in this repository is available under the
MIT
license.
For this simulation, we generate a cohort of 1,000 patients, randomised
1:1 to a hypothetical treatment arm trt in the data)
or control.
In our settings, we assume two longitudinal outcomes (in addition to the time-to-event outcome of all-cause mortality): prostate-specific antigen (PSA), modelled on the log scale, and quality of life (QoL), simulated and then modelled on the logit scale. Once back-transformed to the original scale, QoL is assumed to be bounded between 0 (worst QoL) and 1 (best QoL).
Then, we generate data according to the following trivariate joint model:
where
Note that we also assume:
- Every patient is observed at baseline;
- New observations are collected every 6 to 18 months;
- Administrative censoring at ten years from randomisation (i.e., baseline) is applied.
The longitudinal sub-model for log PSA is defined as
where
The population-level trajectories, by treatment arm, are as follows:
When applying the inverse transformation, we obtain the following population-level trajectories for PSA values:
The longitudinal sub-model for the logit of QoL is defined as
assuming the residual error term
The population-level trajectories of logit QoL are as follows:
If we apply the inverse transformation, we obtain the longitudinal, population-level trajectories from the following plot:
The time-to-event model for all-cause survival is a Weibull proportional hazards model
with scale parameter
The dataset includes variable labels describing the content of each column:
. use data/example.dta
(Simulated dataset from a trivariate joint model.)
. describe
Contains data from data/example.dta
Observations: 6,262 Simulated dataset from a trivariate joint model.
Variables: 11 25 Nov 2025 16:29
----------------------------------------------------------------------------------------------------------------------------
Variable Storage Display Value
name type format label Variable label
----------------------------------------------------------------------------------------------------------------------------
id int %9.0g Unique patient identifier
trt byte %9.0g Randomised binary treatment assignment (0 = control, 1 = treatment)
stime double %10.0g Survival time
event byte %8.0g Binary event indicator variable (0 = censored, 1 = event)
n byte %9.0g Sequential indicator variable for the 1st, 2nd, etc. measurement
N byte %9.0g Total number of measurements per patient
time float %9.0g Longitudinal measurement times
log_psa float %9.0g Longitudinal log PSA values
psa float %9.0g Longitudinal PSA values
logit_qol float %9.0g Longitudinal logit quality of life values
qol float %9.0g Longitudinal quality of life values
----------------------------------------------------------------------------------------------------------------------------
Sorted by: id timeA short descriptive table of the simulated data is also included below:
. codebook, compact
Variable Obs Unique Mean Min Max Label
----------------------------------------------------------------------------------------------------------------------------
id 6262 1000 503.7918 1 1000 Unique patient identifier
trt 6262 2 .5148515 0 1 Randomised binary treatment assignment (0 = control, 1 = treatment)
stime 1000 636 5.699492 .0023133 10 Survival time
event 1000 2 .635 0 1 Binary event indicator variable (0 = censored, 1 = event)
n 6262 14 4.892367 1 14 Sequential indicator variable for the 1st, 2nd, etc. measurement
N 6262 14 8.784733 1 14 Total number of measurements per patient
time 6262 5262 3.805555 0 9.998419 Longitudinal measurement times
log_psa 6262 6262 .7587043 -33.02409 38.96137 Longitudinal log PSA values
psa 6262 6262 1.49e+13 4.55e-15 8.33e+16 Longitudinal PSA values
logit_qol 6262 6262 -.7783099 -5.417343 1.518691 Longitudinal logit quality of life values
qol 6262 6262 .3443611 .0044193 .8203457 Longitudinal quality of life values
----------------------------------------------------------------------------------------------------------------------------


