Motivated by a pregnancy miscarriage study, we propose a Bayesian joint model for longitudinal and time-to-event outcomes that takes into account different complexities of the problem. In particular, the longitudinal process is modeled by means of a nonlinear specification with subject-specific error variance. In addition, the exact time of fetal death is unknown, and a subgroup of women is not susceptible to miscarriage. Hence, we model the survival process via a mixture cure model for interval-censored data. Finally, both processes are linked through the subject-specific longitudinal mean and variance. A simulation study is conducted in order to validate our joint model. In the real application, we use individual weighted and Cox-Snell residuals to assess the goodness-of-fit of our proposal versus a joint model that shares only the subject-specific longitudinal mean (standard approach). In addition, the leave-one-out cross-validation criterion is applied to compare the predictive ability of both models.
In Obstetrics research, a recurring interest is to study longitudinal beta-human chorionic gonadotropin (-HCG) hormone measurements from women during the first quarter of their pregnancies and the pregnancy outcome from some women who had complications leading to miscarriage.1 During the early stages of pregnancy, it is important to consider how the fluctuation in hormone concentration happens within such a framework, since it might alter the pregnancy’s outcome.
This problem was first modeled by Marshall and Barón,2 where they proposed a nonlinear mixed-effects model using a parametric logistic function to model hormone concentration over time using maximum likelihood estimates, and De la Cruz-Mesía and Quintana3 provided a Bayesian approach. To model this biomarker and a pregnancy outcome together, De la Cruz et al.4,5 explain the relationship between a binary response (pregnancy outcome) and the characteristics of longitudinal measurements (hormone levels). So, the joint model is made up of a logistic regression that has individual-specific random effects from a nonlinear mixed-effects model as variables. In De la Cruz et al.,4 the authors compared a number of estimation techniques, including the Laplacian approximation, the naïve two-stage method, best linear unbiased prediction, and Gaussian and adaptive Gaussian quadratures. In De la Cruz et al.,5 the authors proposed a Bayesian inference based on a Markov chain Monte Carlo sampler and introduced autocorrelated errors into the joint model.
Clinicians have a critical interest in being able to evaluate the relationship between longitudinally recorded -HCG and time to early miscarriage. So, the use of subject-specific random effects from a mixed-effects model for longitudinal -HCG data as predictors in a survival model is a typical joint modeling strategy proposed to accomplish this goal. However, it frequently occurs while examining time-to-event data that a portion of participants will never experience the relevant event. From a modeling perspective, the so-called cure models6 incorporate such a characteristic, in which participants are believed to have been cured, and these event periods are considered limitless. Hence, our proposal includes a mixture cure specification7 to model the time until fetal death, where such times are interval-censored. In addition, a nonlinear mixed-effects location scale (MELS) model8 is proposed to capture the trajectories of -HCG hormone and share the within-subject variability.
The remainder of the paper is organized as follows. In Section 2, we present a Chilean pregnancy miscarriage dataset, which was the motivation for the modeling developed in this paper. In Section 3, we gradually introduce the proposed model formulation, as well as its likelihood function and prior distributions. In Section 4, we evaluate the performance of our proposal with a simulation study. In Section 5, we discuss the results of two specifications of shared elements between the longitudinal and survival submodels. Finally, in Section 6, we conclude with a few general remarks. The models implemented in this paper were written in Stan9 and are available at www.github.com/daniloalvares/BJM-MELS-Cure.
Pregnancy miscarriage data
Our motivation comes from a clinical trial study in a Chilean private assisted reproduction center. The data consist of longitudinal -HCG hormone measurements (in a log10 scale, which from now on will be denoted as log(-HCG)) from 173 young women during the first quarter of their pregnancies. This hormone is produced by the placenta during pregnancy. Typically, -HCG levels increase steadily until the end of the first trimester (10 weeks of pregnancy), then decline as the pregnancy progresses.10
In our study data, 49 women had complications that led to a miscarriage. From now on, the term abnormal will be used to refer to this women’s group. In contrast, 124 women had regular pregnancies and formed the normal group. Unfortunately, -HCG levels during the first weeks of pregnancy are recorded infrequently and not always at the same stage of pregnancy for every woman.11,12Figure 1 shows the -HCG profiles over time for both groups.
Longitudinal measurements of log(-HCG) by pregnancy group. -HCG: beta human chorionic gonadotropin.
Figure 1 reveals that there is a notable difference between the longitudinal profiles of each group. In particular, the normal group has an increasing, nonlinear, and homogeneous evolution, while the abnormal group trajectories do not follow a clear pattern, but they have lower -HCG hormone levels than the normal group and much more variability. These preliminary visual analyzes suggest that the distribution of longitudinal measurements depends on the pregnancy group. Hence, we can assume that the shared characteristics of -HCG trajectories potentially help to explain the time until miscarriage. Furthermore, as previously pointed out, we can also see that both groups have irregular frequency and number of measurements. Table 1 shows the frequency of longitudinal measurements by pregnancy group.
Frequency of the number of individual longitudinal measurements by pregnancy group.
Pregnancy group
Number of longitudinal measurements
1
2
3
4
5
6
Normal
35
44
42
3
0
0
Abnormal
17
9
16
5
1
1
The main objective of this study is to analyze the association of the -HCG levels with the time until fetal death. Here, it is important to note that only the abnormal group experiences the event of interest (fetal death). Another relevant characteristic of the problem is that the exact time of fetal death is unknown. However, miscarriage symptoms and emergency medical follow-up usually occur within a period of 10 days (regular time for miscarriage detection through medical visit and/or clinical examination in Chile) after the last measurement of the -HCG hormone.13 Assuming such a time window, Figure 2 shows the time interval in which fetal death occurred for the 49 women in the abnormal group. We can observe that most women had an early pregnancy loss between the 20th and 60th day of pregnancy.
Time interval (10-day range from the last measurement of the -HCG hormone) in which fetal death occurred for abnormal group women. -HCG: beta human chorionic gonadotropin.
The data of this study present a severe limitation which is the absence of (baseline) covariates. So, conclusions are limited to the knowledge that can be extracted from longitudinal measurements and survival times.
The Bayesian joint model
Conceptually, a joint model connects two or more processes through shared terms.14,15 Here, such processes are described by a longitudinal submodel for the -HCG hormone (endogenous time-varying covariate) and a survival submodel for the time until fetal death. Each element of our joint modeling proposal is introduced in the following.
Let be the log(-HCG) measurement associated with the th woman, , measured at time . It is worth noting that log(-HCG) is always positive once -HCG for pregnant women is greater than 1. Define the conditional distribution of given (parameters), (random effects), and (error standard deviation) as a generic additive error model:
where represents the mean response at time and is a residual error. We assume that random effects, , given , follow a multivariate normal distribution with zero-mean vector and variance-covariance matrix . The residual errors are assumed to be conditionally independent and identically distributed as .
The survival submodel aims to model the time until fetal death, which occurred within 10 days after the last measurement of the -HCG hormone. Here, two important characteristics should be noted: (i) A part of the women (normal group) are not susceptible to the event of interest, and (ii) the exact time of fetal death is unknown, leading to interval-censored observations.
From a modeling perspective, (i) requires a mixture cure model, since some women have given birth and are therefore not susceptible to fetal loss.7 Specifically, let be a binary random variable defined as 0 for a susceptible woman and 1 for an immune woman. So, the incidence model is given by , where represents the cure fraction. In addition, let be the time until fetal death for the susceptible woman (i.e. conditional on ), so the latency model is expressed through a proportional hazard specification:
where and are Weibull hazard shape and log-scale parameters, respectively. The term has the role of connecting the longitudinal and survival submodels, while measures the strength of this association. We chose a Weibull baseline hazard because a similar study13 using the same data corroborated that this specification is sufficiently adequate, but other alternatives could also be employed, such as piecewise and spline functions.16
Adding the three-parameter logistic specification
Typically, the longitudinal submodel (1) of a joint model is defined as a linear mixed-effects model with random intercept and slope.17–22 However, -HCG hormone trajectories clearly show nonlinear patterns (see Figure 1) that are not captured well with such a structure. To get around this issue, Marshall and Barón2 successfully proposed a three-parameter logistic specification given by:
where , , and . The joint model (1)-(2) using the three-parameter logistic specification (3) will be called the reference joint model.
Adding the MELS specification
Figure 1 suggests that the variability of longitudinal trajectories may be a risk factor for the time until fetal death. In order to incorporate this characteristic into the modeling, we specify within-subject variances using a MELS model8 as follows:
where for (number of longitudinal measurements) and for . Hence, following the proposal of Barrett et al.,23 we rewrite the hazard function (2) including as a second shared term:
Likelihood and priors
The likelihood function of the full parameter vector and random effects of the joint model (4)-(5) using the three-parameter logistic specification (3) is given by:
where is the value of log(-HCG) for the th woman at visit ; () is the time interval in which the miscarriage occurred for a woman belonging to the abnormal group (); is the right-censored observation (last longitudinal measurement time) of a woman belonging to the normal group (); denotes the full parameter vector and random effects; represents the conditional probability density function of given described in (4) with respective random effects density function denoted by ; and is the survival function derived from (5).
We assume independent and proper prior distributions.24 More specifically, all longitudinal and survival fixed effects, , follow a Normal(); the error variance, , and the Weibull shape parameter, , follow a half-Cauchy();25 and the random effects variance-covariance matrix follows an inverse-Wishart(),26 where represents a identity matrix. We previously investigated the sensitivity of our prior distributions compared to vaguer ones, Normal() and half-Cauchy(), and we concluded that our choice is weakly informative, since the results were equivalent, differing only in computational time.
Simulation study
We conducted a simulation study to evaluate the performance of our proposal in estimating the parameters and , compared to the reference joint model. We explored two scenarios: (I) simulated data from the joint model (1)-(2) (share ) and (II) simulated data from the joint model (4)-(5) (share and ). In both cases, we considered 1–4 and 5–10 longitudinal measurements per individual, (sample size), and repetitions. The specification of the parameters is based on the fit of each model with the pregnancy miscarriage data (see Section 2). Specifically, Scenario I: , , , , , , , and ; Scenario II: , , , , , , , , and . Table 2 summarizes the results and terms of bias and 95% coverage probability.
Bias and 95% CP for and in Scenarios I (true model: (1)-(2)) and II (true model: (4)-(5)) considering 1–4 and 5–10 LMPI with .
CP: coverage probability; LMPI: longitudinal measurements per individual.
The population parameters ’s are well estimated in all scenarios for both joint models. In Scenario I, where (1)-(2) is the true model, our proposal appropriately estimates the association parameter even with few longitudinal measurements per individual. In Scenario II, where (4)-(5) is the true model, our proposal is also suitable, as expected, while the reference joint model produces biased estimates of the parameter associated with the shared mean response.
Application
We implemented Bayesian joint models (1)-(2) (share ) and (4)-(5) (share and ) in rstan9 R-package (version 2.32.7) and run each of them with three Markov chains and 6000 iterations. The first half of the posterior samples was discarded (warm-up period), and then we made the inference with the remaining ones (9000 posterior samples). Convergence and efficiency were checked through Rhat and effective sample size.24 All models were run on a Dell laptop with 2.2 GHz Intel Core i7, 32 GB RAM, OS Windows.
We analyzed the goodness-of-fit through longitudinal and survival residuals.27 Specifically, individual weighted residuals (IWRES) for longitudinal submodels and Cox-Snell residuals for survival submodels, considering interval-censored observations.28Figure 3 shows both residuals by joint model.
First column: Individual weighted residuals (IWRES). Second column: Kaplan–Meier estimates of the Cox–Snell residuals (dashed black line) and its 95% confidence interval (gray shadow), where the solid red line represents the survival function of the unit exponential distribution. (a) Longitudinal and survival residuals from joint model (1)-(2) (share ); (b) Longitudinal and survival residuals from joint model (4)-(5) (share and ).
In both cases, IWRES did not suggest any model misspecification, but it is possible to observe less dispersion of residuals considering the MELS specification (Figure 3b). Additionally, the Kaplan–Meier estimates of the Cox–Snell residuals were close to the theoretical survival curves (unit exponential distribution), indicating a suitable fit for both models.
We used the leave-one-out cross-validation (LOO-CV)29 to select the best joint model specification. This criterion is based on the out-of-sample prediction accuracy from a fitted Bayesian model using the log-likelihood evaluated at posterior simulations of the parameter values.30 Interpretatively, a lower LOO-CV value indicates a better model fit. It is worth noting that LOO-CV compares models based on their predictive performance, so it can be used for different classes of models, including non-nested specifications. Table 3 shows a posterior summary for both joint models as well as their respective LOO-CV.
Posterior summary for the parameters of interest from joint models (1)-(2) (share ) and (4)-(5) (share and ) using the three-parameter logistic specification (3).
In Table 3, we can see that the population parameters, , and , that describe the median trajectory of the three-parameter logistic specification (3), are slightly different. Figure 4 shows such a trajectory using each joint model. In fact, the difference between the curves is minimal over the range of measurements.
Posterior mean and 95% credible interval for the three-parameter logistic specification (3) from joint models (1)-(2) (share , blue color) and (4)-(5) (share and , red color) using population parameters , , and (see Table 3). Trajectories in gray color are the longitudinal measurements of log(-HCG) of the 173 women in the study (both groups). -HCG: beta-human chorionic gonadotropin.
Still in Table 3, the association parameter , which connects the longitudinal process mean () to the survival submodel, is negative for both joint models. This means that higher -HCG hormone levels have a protective effect in terms of time until fetal death. This result corroborates the previous visual inspection (see Figure 1) that the abnormal group (women susceptible to miscarriage) presents longitudinal trajectories with lower -HCG than the normal group. The joint model (4)-(5) also shows a strong and positive association () between the within-subject variance and the time until fetal death. This is interpreted as greater intra-woman -HCG variability leads to a higher risk of miscarriage. This result is also consistent with the observed pattern of -HCG hormone levels in the abnormal group. In terms of model selection, the LOO-CV criterion indicates a better fit using the joint model that shares and , but this model takes more than twice as long as the reference joint model.
Discussion
In this paper, we have proposed a Bayesian joint model based on a nonlinear MELS submodel for longitudinal data and a mixture cure submodel for interval-censored survival data. In addition, such submodels have shared terms described through the subject-specific longitudinal mean and variance.
We have compared our proposal with a reference joint model that shares only the subject-specific longitudinal mean. In the simulation study, our proposal has performed equivalently or better than the competing model. In the application, both approaches have shown suitable goodness-of-fit in terms of longitudinal and survival residuals (see Figure 3). However, the inclusion of within-subject variance as a shared term contributed to a better understanding of the -HCG hormone pattern of women who had a miscarriage. Specifically, we have argued that increasing such variance leads to higher risks of fetal loss (see Table 3). Still, we highlight that this conclusion should be taken with extreme caution, as our study does not include baseline variables (not available) that could potentially be relevant risk factors.
Both joint models presented high computational times (27 and 80 minutes) given that our Chilean pregnancy miscarriage study has a relatively small sample size (173 women with few longitudinal measurements). These times may be reduced using two-stage strategies that preferentially correct the estimation bias.31
In conclusion, we hope this paper inspires other authors to consider all complex elements of real data in their joint modeling. In particular, we encourage researchers to adapt our codes for other problems, as well as to implement our joint model proposal in other statistical Bayesian model tools, such as JAGS32 and INLA.33
Footnotes
Acknowledgments
The authors thank Guillermo Marshall for facilitating the pregnancy miscarriage data, as well as the Editor, the Associated Editor, and three referees for their multiple, detailed, and constructive reports.
Declaration of conflicting interests
The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The authors disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: D.A. was supported by the Medical Research Council grant MC_UU_00002/5. C.M. was supported by the ANID/FONDECYT grant 1190801. R.D.L.C. was supported by grants ANID/FONDECYT 1181662, ANID/PIA/ANILLOS ACT210096 & Data Observatory Foundation, and ANID Technology Center DO210001.
ORCID iDs
Danilo Alvares
Rolando De la Cruz
References
1.
ConfinoEDemirRHFribergJ, et al.The predictive value of hCG beta subunit levels in pregnancies achieved by in vitro fertilization and embryo transfer: An international collaborative study. Fertil Steril1986; 45: 526–531.
2.
MarshallGBarónAE. Linear discriminant models for unbalanced longitudinal data. Stat Med2000; 19: 1969–1981.
3.
De la Cruz-MesíaRQuintanaFA. A model-based approach to Bayesian classification with applications to predicting pregnancy outcomes from longitudinal beta-hCG profiles. Biostatistics2007; 8: 228–238.
4.
De la CruzRMarshallGQuintanaFA. Logistic regression when covariates are random effects from a non-linear mixed model. Biometrical J2011; 53: 735–749.
5.
De la CruzRMezaCArribas-GilA, et al.Bayesian regression analysis of data with random effects covariates from nonlinear longitudinal measurements. J Multivar Anal2016; 143: 94–106.
6.
PengYYuB. Cure models: Methods, applications, and implementation. 1st ed. New York, NY, USA: Chapman & Hall/CRC, 2021.
7.
BerksonJGageRP. Survival curve for cancer patients following treatment. J Am Stat Assoc1952; 47: 501–515.
8.
HedekerDMermelsteinRJDemirtasH. An application of a mixed-effects location scale model for analysis of ecological momentary assessment (EMA) data. Biometrics2008; 64: 627–634.
9.
Stan Development Team. RStan: The R interface to Stan. R package version 2.32.7, New York, http://mc-stan.org/, 2025.
10.
NwabuobiCArlierSSchatzF, et al.HCG: Biological functions and clinical applications. Int J Mol Sci2017; 18: 1–15.
11.
De la Cruz-MesíaRFuentesCMezaC, et al.Predicting pregnancy outcomes using longitudinal information: A penalized splines mixed-effects model approach. Stat Med2017; 36: 2120–2134.
12.
GaskinsJTFuentesCDe la CruzR. A Bayesian nonparametric model for classification of longitudinal profiles. Biostatistics2023; 24: 209–225.
13.
De la CruzRLavielleMMezaC, et al.A joint analysis proposal of nonlinear longitudinal and time-to-event right-, interval-censored data for modeling pregnancy miscarriage. Comput Biol Med2024; 182: 1–17.
14.
RizopoulosD. Joint models for longitudinal and time-to-event data: With applications in R. 1st ed.Boca Raton, FL, USA: Chapman & Hall/CRC, 2012.
15.
ElashoffRLiGLiN. Joint modeling of longitudinal and time-to-event data. 1st ed. Boca Raton, FL, USA: Chapman & Hall/CRC, 2016.
16.
LázaroEArmeroCAlvaresD. Bayesian regularization for flexible baseline hazard functions in Cox survival models. Biometrical J2021; 63: 7–26.
17.
CrowtherMJAbramsKRLambertPC. Joint modeling of longitudinal and survival data. Stata J2013; 13: 165–184.
18.
Proust-LimaCSéneMTaylorJMG, et al.Joint latent class models for longitudinal and time-to-event data: A review. Stat Methods Med Res2014; 23: 74–90.
19.
FurgalAKCSenATaylorJMG. Review and comparison of computational approaches for joint longitudinal and time-to-event models. Int Stat Rev2019; 87: 393–418.
20.
PapageorgiouGMauffKTomerAet al.An overview of joint modeling of time-to-event and longitudinal outcomes. Annu Rev Stat Appl2019; 6: 223–240.
21.
AlsefriMSudellMGarcía-FiñanaM, et al.Bayesian joint modelling of longitudinal and time to event data: A methodological review. BMC Med Res Methodol2020; 20: 1–17.
22.
AlvaresDRubioFJ. A tractable Bayesian joint model for longitudinal and survival data. Stat Med2021; 40: 4213–4229.
23.
BarrettJKHuilleRParkerR, et al.Estimating the association between blood pressure variability and cardiovascular disease: An application using the ARIC study. Stat Med2018; 38: 1855–1868.
24.
GelmanACarlinJBSternHS, et al.Bayesian data analysis. 3rd ed. Boca Raton, FL, USA: Chapman & Hall/CRC, 2013.
25.
RubioFSteelM. Flexible linear mixed models with improper priors for longitudinal and survival data. Electron J Stat2018; 12: 572–598.
26.
SchuurmanNKGrasmanRPPPHamakerEL. A comparison of inverse-Wishart prior specifications for covariance matrices in multilevel autoregressive models. Multivariate Behav Res2016; 51: 185–206.
27.
DesméeSMentréFVeyrat-FolletC, et al.Using the SAEM algorithm for mechanistic joint models characterizing the relationship between nonlinear PSA kinetics and survival in prostate cancer patients. Biometrics2017; 73: 305–312.
28.
FarringtonCP. Residuals for proportional Hazards models with interval-censored survival data. Biometrics2000; 56: 473–482.
29.
VehtariAMononenTTolvanenV, et al.Bayesian leave-one-out cross-validation approximations for Gaussian latent variable models. J Mach Learn Res2016; 17: 1–38.
30.
VehtariAGelmanAGabryJ. Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC. Stat Comput2017; 27: 1413–1432.
31.
AlvaresDLeiva-YamaguchiV. A two-stage approach for Bayesian joint models: Reducing complexity while maintaining accuracy. Stat Comput2023; 33: 1–11.
32.
AlvaresDLázaroEGómez-RubioV, et al.Bayesian survival analysis with BUGS. Stat Med2021; 40: 2765–3020.
33.
AlvaresDvan NiekerkJKrainskiET, et al.Bayesian survival analysis with INLA. Stat Med2024; 43: 3975–4010.