Manuscript Offprint
arXiv:2608.24328A Structural FHMM for Interpretable Disease Trajectories in T2DM
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.
Abstract
In this work, we propose a structural variant of the Factorial Hidden Markov Model (FHMM) for the analysis of disease trajectories in patients with Type 2 diabetes mellitus (T2DM). The model represents a patient's latent health state as a combination of multiple independent, simultaneously evolving components, associated with comorbidities and lab results. This structured latent representation facilitates the identification of clinically meaningful patient states and clustering of common disease trajectories. We evaluate the proposed approach using The IQVIA Medical Research Data incorporating data from THIN, a Cegedim database of anonymized electronic health records (EHR), identifying patients with a first-ever prescription for a non-insulin antidiabetic drug (NIAD) between January 2006 and December 2019. The model identifies multiple clinically coherent latent components corresponding to known patterns of diabetes-related complications and reveals heterogeneous progression pathways, including distinct microvascular-dominant and multi-organ trajectories associated with elevated comorbidity burden and mortality. These results demonstrate that the proposed framework captures meaningful longitudinal structure in EHR data and provides interpretable insights into the evolution of T2DM and its comorbidities.
1 Background
Type 2 diabetes mellitus (T2DM) is a chronic metabolic disorder characterized by elevated blood glucose levels resulting from insulin resistance and inadequate insulin secretion. It represents a major global health concern and is frequently accompanied by a range of comorbidities, which substantially worsen quality of life and increase the risk of morbidity and mortality [1]. The presence and progression of such comorbidities contribute to the heterogeneity of T2DM trajectories, making disease management and risk stratification particularly challenging. The inference of a patient's underlying health state from longitudinal clinical observations, together with information on T2DM and its associated comorbidities, can support the identification of disease progression patterns and emerging health risks. Leveraging retrospective electronic health records (EHRs) to characterize these evolving health states offers the potential to improve disease understanding, stratify patients into clinically meaningful subgroups, and inform timely interventions.
In this study, we analyze longitudinal observations from EHRs associated with T2DM and multiple comorbidities in order to infer patients' latent health states and characterize common patterns of disease evolution. To this end, we propose a statistical model designed to capture the multi-dimensional and dynamic nature of patient health, with a particular focus on interpretability of the latent representation and its clinical relevance.
Specifically, we consider a structural variant of the Factorial Hidden Markov Model (FHMM) [2], which enables modeling the dynamics of a multi-dimensional patient health state through several independent latent components evolving simultaneously over time. Given longitudinal clinical observations, the proposed model infers the latent configuration of these components, providing a structured representation of disease progression and associated health risks. In contrast to a standard Hidden Markov Model (HMM), which represents patient health using a single latent state, the FHMM framework allows the patient's overall condition to be approximated as a combination of a small number of evolving latent processes. This structure increases modeling flexibility and facilitates interpretation, as individual latent chains can be associated with distinct aspects of disease evolution or comorbidity burden.
By using retrospective information on patients’ health indicators and disease history, the proposed model enables the identification of clinically meaningful latent states and the analysis of transitions between them. The resulting latent trajectories can be used to cluster patients according to common progression patterns, characterize typical disease pathways, and assess the evolution of comorbidity-related risks over time.
Related work. Tracking and modeling comorbidities from longitudinal health observations in patients with T2DM is crucial for understanding disease heterogeneity and supporting effective disease management. A wide range of statistical and machine learning approaches have been proposed to analyze large-scale health data and uncover temporal patterns associated with disease progression and risk. HMM and their generalizations are among the most widely used probabilistic approaches for modeling disease dynamics in healthcare applications [3, 4, 5, 6]. Extensions such as mixtures of Input–Output Hidden Markov Models have been proposed to capture more complex temporal dependencies [7]. Nonparametric latent feature models, including approaches based on the Indian Buffet Process, have also been explored for comorbidity analysis, particularly in the context of psychiatric disorders [8].
More recently, deep generative models have been applied to longitudinal clinical data. In [9], the authors propose a variational autoencoder-based framework to learn latent representations that jointly generate clinical measurements and medical concepts. While effective, their approach requires manual assignment of latent dimensions to specific medical concepts. In contrast, our model automatically learns a structured factorization of the latent space by construction. Moreover, the latent representation in our approach is discrete and subject to monotonicity constraints, which enhances interpretability and facilitates the analysis of disease trajectories.
Methods addressing the joint evolution of multiple diseases have also been proposed. For example, [10] introduces a bivariate copula-based hidden process to model the interaction between two diseases using population-level time series. In the context of T2DM, machine learning approaches have been applied to model disease progression [11], while clustering-based analyses have been used to study patterns of comorbidities [12]. Our work complements these approaches by providing a structured, interpretable latent-state model adapted to the analysis of complex, multi-comorbidity disease trajectories.
2.1 Data
The IQVIA Medical Research Database UK (IMRD-UK) incorporates data supplied by The Health Improvement Network (THIN), a Cegedim database of anonymized electronic health records generated from the daily records of General Practitioners (GPs). The study protocol and use of the data were reviewed and approved by the Scientific Review Committee (SRC, reference number 20SR062).
The dataset includes patients from participating primary care practices who have provided general consent for their data to be used for research purposes. Consent may be withdrawn at any time, in which case the individual's data are removed from the dataset. Secondary care providers, such as ambulatory care or specialists, provide additional feedback on diagnoses to the GPs.
Generally, the database comprises routinely collected data from clinical practice, including patient diagnoses, symptoms, prescriptions, referrals, immunizations, laboratory test results (including glycated hemoglobin [HbA1c]), selected behavioral factors (body mass index [BMI], alcohol use, and smoking status), and demographic characteristics. As with most electronic healthcare databases, data are generated during routine care rather than for research purposes, resulting in unequally spaced observations and incomplete capture of certain variables. Lifestyle factors such as BMI, smoking status, and alcohol consumption are subject to missingness. In addition, diagnoses are recorded only when they are among the main reasons for a visit, laboratory tests are captured only when ordered; and while medication prescriptions are identified, prescription fills and adherence are not known.
2.2 Cohort description
We identified all adult patients (aged 18+) with a first-ever prescription of a non-insulin antidiabetic drug (NIAD) between January 1, 2006, and December 31, 2019. The index date was defined as the date of the first NIAD prescription. To ensure identification of new users, patients were required to have at least one year of valid data prior to the index date. We excluded patients without any laboratory measurement for variables of interest (see Table 1) within the 4-years prior to the index date after data aggregation (see Section 2.2.1).
2.2.1 Data preprocessing

Figure 1: Graphical representation of the preprocessing steps.
To harmonize the dataset and prepare it for modeling, we applied the following data preparation steps. A summary of these steps is provided in Figure 1.
Comorbidities and Laboratory Measurements: The comorbidities and laboratory variables included in the analysis are listed in Table 1. Comorbidities were identified at or prior to the index date and during follow-up using read codes recorded at each patient's clinical encounters. Only chronic conditions were considered. Accordingly, a comorbidity c was defined as present at time t if any corresponding read code appeared during the relevant six-month interval. Once identified, comorbidities were assumed to persist over time, reflecting their chronic or recurrent nature; thus, the indicator for comorbidity c remained set to 1 following its first occurrence. In the base model, drugs were only used in modeling the initial state. A detailed discussion of the effects of drugs used in the transition matrix is provided in Appendix C.
The laboratory values are standardized to consistent units (see Table 1), and outliers are removed using predefined thresholds (see Appendix A). To address irregular measurement timing and partial missingness inherent to routine clinical data, laboratory measurements were aggregated into six-month intervals, with the median value used when multiple measurements were available within a given interval. Patients were excluded if any required laboratory variable had no recorded measurements during the four years preceding NIAD initiation. This step was necessary to enable forward imputation of missing values during the post-NIAD period.
Additionally, to separate the timing of doctors' decisions regarding diagnoses and medication prescriptions, we used the comorbidity status (presence or absence) and lab tests shifted forward in time relative to the prescriptions. This approach helps avoid issues related to six-month aggregation, where diagnoses might be influenced by medication prescriptions rather than the patient's actual health state.
To further preserve the intended temporal ordering between patient health status and clinical decision-making, comorbidity indicators and laboratory measurements were shifted forward in time relative to medication prescriptions. This approach mitigates potential reverse-causation artifacts introduced by six-month aggregation, whereby diagnoses or laboratory results recorded shortly before any treatment initiation could otherwise appear contemporaneous with (or influenced by) drug exposure.
Clinical Stratification: Patient observations were stratified by age and sex to account for clinically meaningful heterogeneity. Age was determined at the index date and categorized into two groups: patients aged 64 years or younger and those aged 65 years or older. This stratification reflects differences in diabetes progression and the burden of age-related comorbidities across the life course [13]. Additionally, analyses were stratified by sex to capture known differences in disease prevalence and comorbidity profiles, such as osteoporosis, between male and female patients [14].
| Comorbidities | Lab Values | Drugs (with ATC code) |
|---|---|---|
| • Stroke• Myocardial infarction (MI)• Congestive heart failure (CHF)• Peripheral vascular disease (PVD)• Diabetic retinopathy (DR)• Hypertension (HT)• Chronic kidney disease (CKD)• Osteoporosis• Chronic obstructive pulmonary disease (COPD)• Chronic liver disease (CLD) | • Glycated hemoglobin (Hb A1c) in %• Low-density lipoprotein (LDL) cholesterol in mmol/L• High-density lipoprotein (HDL) cholesterol in mmol/L• Triglycerides (TG) in mmol/L• Blood pressure (Systemic/Diastolic) in mmHg• Body Mass Index (BMI) in kg/m• Glomerular filtration rate (GFR) in mL/min/1.73m | • Diabetes Drugs • Antithrombotic agents (B01)• Cardiac therapy (C01)• Antihypertensives (C02)• Diuretics (C03)• Beta blocking agents (C07)• Calcium channels blockers (C08)• ACE inhibitors (C09)• Statins (C10)• Corticosteroids (H02)• Drugs for treatment of bone diseases (M05) |
Table 1: List of variables that are included in the model.
2.3 Structural FHMM
Our modeling approach is based on Factorial Hidden Markov Model (FHMM) [2], which is an extension of the hidden Markov chain, where the output is conditioned not on one hidden Markov chain with states, but on independent hidden Markov chains. This allows to model the time series depending on several independent latent processes (see Figure 2). In terms of comorbidities and lab-values progression modeling, the FHMM approach translates into the assumption that there exist hidden health state components, which are independent and that are jointly influencing the output. Although the independence assumption may appear unrealistic, since body systems rarely function in isolation, the FHMM can be understood as an independent basis decomposition of the dynamics, where several hidden processes evolve separately and jointly generate the observed comorbidities and lab values. This view highlights FHMM as a structured approximation: the latent chains act as abstract basis processes that capture key aspects of disease progression.
We assume that the evolution of comorbidity states and laboratory test measurements, denoted by
Including Gliclazide, Glimepiride, Glipizide, Metformin, Pioglitazone, Rosiglitazone, Sitagliptin, Dapagliflozin.

Figure 2: Directed graphical model of a FHMM with hidden chains. Arrows represent causal relationships and gray nodes are observed variables. White nodes are not observed. The variables are the drugs taken at time that influence the patient health state . The results of the lab tests and the set of comorbidities are direct consequences of the health state at time .
, follows the generative process defined by
where denotes the joint latent configuration of parallel hidden Markov chains with possible states each. At each time point, the combination of these latent variables, each taking one of -states, determines the distribution of the observable .
In the presence of the auxiliary input variables, such as in our case medications, one can model the output assuming the dependence of the hidden states on the input, which leads to Input-output FHMM formulation.
Exact inference for (3) can, in principle, be carried out by representing the FHMM as a single HMM with states, where the transition matrix can be written as
where is the Kronecker product. Nevertheless, the introduction of additional chains makes the estimation intractable, as a naive implementation of the Forward-Backward algorithm has complexity . The complexity can be reduced to by carefully computing the matrix-vector dot product [15], but still grows exponentially in the number of chains. One of the ways to make the estimation tractable is to use variational approximation, which we describe in Section 2.4.
We impose the following problem-specific structure on the FHMM to improve identifiability and interpretability.
2.3.1 Problem-specific structure
The transition matrix specifies the probabilities of moving between latent health states from one time step to the next. The general FHMM defined in Section 2.3 is not easily interpretable as the states of the chains are not ordered and any permutation of the states labels gives the same model. In order to make the identification of the states possible, we assume that states are ordered by worsening of the patient's condition, and that lower state values represent a healthy patient. Additionally, we assume that the health of a patient can degrade only by d units (a jump of d states) and that the last state is an absorbing state, representing the impossibility of improving the patient's health condition. These assumptions mean that the transition matrix is a band matrix with bandwidth d, where the last row of the matrix contains all zeros except in the last column, which is equal to one. Figure 3 shows all possible transitions when d = 1. The transition matrix is fully parameterized without the inclusion of input variables, such as medications. A discussion on incorporating medications into the parameterization is provided in Appendix C.

Figure 3: Possible transitions between states of a hidden chain with 5 states and jumps of size d = 1.
The Emission probability should capture that the higher the patients' state value is, the worse their health conditions are. In particular, the conditional mean
should be a monotone function of each state component for all , where is a one-hot encoded version of and is some link function. Note that for identifiability issues and that the intercept is captured by .
As in [16], to guarantee monotonicity we parametrize the variable as the cumulative sum of and , i.e.,
where is a lower triangular matrix with all ones. This means that each difference between successive coefficients is either non-negative or non-positive: if , then
hence is non-decreasing. Similarly, if , then
hence is non-increasing. To decide whether the slope should be positive or negative, we add a group-lasso penalty [17]:
This penalty enforces sparsity at the group level, i.e. it encourages either (purely decreasing slope) or (purely increasing slope).
The initial state is modeled as a function of the list of drugs taken over a period of 4 years prior to NIAD, age, smoking states and alcohol status jointly denoted by . The distribution is assumed to be unimodal and is parametrized by a gamma distribution, i.e.,
with and . All parameters are assumed to be nonnegative. If is close to zero, the probability mass is concentrated mostly around the lowest state value, whereas larger values of increase the probability of starting from a higher state value.
Assuming that a drug prescription is equivalent to a degradation of the patient's health, we impose and . In addition, , and follow a priori a (truncated) Gaussian distribution centered at 0, 1 and 1 respectively, which is equivalent to add the penalizations , and to the objective function. The underlying assumptions are
-
the drug effect is a priori small (i.e., is likely to be small),
-
in the absence of drugs, the likelihood of starting from a higher state is small, that is, the prior distribution is .
2.4 Model estimation
Parameters of the models are estimated via Expectation-Maximization (EM) following the work of Ghahramani [2], with the aim to maximize the Evidence Lower Bound (ELBO)
over a class of approximative distributions (E step) and the parameters (M step), where we used the notation to denote the sequence from to . In [2], the authors proposed to use a structured mean field variational approximation [18]
with
(7)
as an approximation of the optimal distribution , which reduces the inference complexity to in the case of Gaussian emissions. The parameters are learned by optimizing the ELBO (6).
In the case of binary outputs, such as comorbidities, the complexity still grows exponentially in the number of chains [15]. However, inspired by the Gaussian case, a second order approximation of the emission log-likelihood is derived using the inequality [19]
with and some additional variable . Exploiting this inequality reduces the complexity of the model training to (see Appendix B for more details). After training, parameters are kept fixed and the parameters are learned when presented with new data. We refer this step as "fine-tuning".
2.5 Trajectory analysis
The emission parameters model the risk of developing a comorbidity for a given state, but do not capture the progression of comorbidities over time. On the other hand, the sequence of hidden states encodes the temporal dynamics of disease evolution, allowing us to infer how patients transition between latent health states and how these transitions influence the development and accumulation of comorbidities across time.
In particular, the variational posterior distribution is given by (7), after fitting the parameters for each patient. The latter is computed using the Baum–Welch algorithm for HMMs (see [2]). From the posterior distribution, we calculate the expected state of each latent chain at each time step as
yielding an M-dimensional representation per time point. We then apply K-means clustering to all time steps, selecting the number of clusters based on the Davies–Bouldin index and prediction strength [20, 21].
2.6 Experimental setup
Patient data were partitioned into three distinct subsets: training (80%), validation (10%), and test (10%). Stratification was applied to ensure a consistent distribution of comorbidities across these subsets (see Table 6 in the Appendix).
All models were trained for a maximum of 300 EM iterations, with early stopping applied if the objective function F showed no improvement. Model parameters were initialized to zero, except for , , which were initialized to one. Multiple FHMMs with varying numbers of chains and states were trained, and model selection was performed using the Akaike Information Criterion (AIC) [22] and the Bayesian Information Criterion (BIC) [23].
3 Results
3.1 Patient cohort and characteristics
After applying the preprocessing workflow described in Section 2.2.1, the final cohort comprised 88201 patients, including 47983 men and 40218 women. Figure 4 illustrates the filtering process of patients based on missing laboratory data during the four years preceding NIAD initiation. In total, 100325 patients were excluded due to missing data for key laboratory values.

Figure 4: Filtering of patients based on missing laboratory data during the four years preceding NIAD initiation. A total of 100325 patients were excluded. Abbreviations are defined in Table 1.
The median follow-up duration after NIAD initiation was approximately 4.0 years across all groups. Baseline patient characteristics at the index date (first NIAD prescription) are summarized in Table 2. Continuous variables, including age, body mass index (BMI), and glycated hemoglobin (HbA1c), are reported as medians with interquartile ranges (IQRs), while categorical variables—such as sex, smoking status, and comorbidities—are presented as counts and percentages.
Smoking prevalence was higher among men than women. Hypertension and diabetic retinopathy were the most prevalent comorbidities at baseline, with diabetic retinopathy showing the greatest increase in prevalence following NIAD initiation. Comorbidities that developed after NIAD initiation are indicated in parentheses in Table 2.
3.2 Model selection
Table 3 presents the AIC and BIC scores for various models evaluated on the validation set. We use the notation to denote a factorial hidden Markov model (FHMM) with chains, states per chain, and a transition matrix bandwidth of . Similarly, refers to a standard hidden Markov model (HMM) with states and a transition matrix of bandwidth .
For comparison, an HMM with states is evaluated against an FHMM of equivalent size. In the FHMM, each chain has 2 possible transitions ( ), which corresponds to an HMM bandwidth of . Because the relationship between HMM state values and worsening health conditions is less direct (where a single disease progression may be too restrictive), the HMM emission probabilities are parameterized without monotonicity constraints, and drug information is excluded from the transition matrix input.
Memory constraints limit our comparison to a state dimension of , with K=3. In the HMM, the full matrix
| Sex Age group | Men | Women | ||
|---|---|---|---|---|
| < 65 | 65+ | < 65 | 65+ | |
| Number of patients | 27191 | 21989 | 20792 | 18229 |
| Average age at NIAD (y) SD | ||||
| Median follow-up duration in years post-NIAD [IQR] | ||||
| Average BMI at NIAD () SD | ||||
| Average HbA1c at NIAD (%) SD | ||||
| % Ever smoked | 45.2 | 34.4 | 39.4 | 28.8 |
| Comorbidities at NIAD initiation (%) | ||||
| Stroke | 5.3 | 15.6 | 4.5 | 13.9 |
| Myocardial infarction | 8.0 | 15.8 | 2.6 | 7.1 |
| Congestive heart failure | 3.8 | 11.9 | 1.9 | 9.2 |
| Peripheral vascular disease | 3.3 | 10.1 | 1.4 | 5.0 |
| Diabetic retinopathy | 32.3 | 35.3 | 29.8 | 34.7 |
| Hypertension | 57.6 | 70.7 | 53.9 | 77.4 |
| Chronic kidney disease | 5.4 | 10.6 | 6.6 | 9.6 |
| Osteoporosis | 0.6 | 1.9 | 2.2 | 10.6 |
| COPD | 6.4 | 15.6 | 6.7 | 13.5 |
| Chronic liver disease | 5.1 | 3.0 | 6.2 | 3.7 |
| Laboratory measurements 6 months before NIAD | ||||
| Diastolic blood pressure (mmHg) | ||||
| Systolic blood pressure (mmHg) | ||||
| GFR (mL/min/) | ||||
| HDL (mmol/L) | ||||
| LDL (mmol/L) | ||||
| Triglycerides (mmol/L) | ||||
Table 2: Patient characteristics at the index date (NIAD initiation) for the cohort after preprocessing. Comorbidities are reported as percentages of the cohort population. Laboratory measurements are summarized as mean values, with the proportion of missing observations reported in parentheses. Abbreviations are defined in Table 1. SD denotes standard deviation and IQR denotes interquartile range.
must be computed for all patients and timesteps, where is the one-hot encoding of . In contrast, the FHMM primarily requires computing
\xi_{t}^{(m)}=\mathbb{E}\left[\tilde{H}_{t}^{(m)}\tilde{H}_{t-1}^{(m)}^{\top}\right]\in\mathbb{R}^{K\times K}for all patients, timesteps , and chains . Since memory complexity scales quadratically with , we kept small. In particular, increasing the number of states from 4 to 6 did not necessarily improve the BIC on the validation set for larger models (see Table 3).
The top-performing model was FHMM(8, 4) across all sex and age groups, except among Men < 65, for whom FHMM(6, 4) performed better according to both BIC and AIC. The model FHMM(8, 4) corresponds to the largest latent space, capable of encoding up to possible states. In what follows, we will focus on the best performing model for each age and sex group. Generally, FHMM models consistently outperform HMM models in terms of BIC.
3.3 Model analysis
Next we provide the analysis of the results for Women < 65 subgroup. Other subgroups can be found in the Appendix. The model selected on validation was "fine-tuned" on the testing set, meaning that the variational parameters were newly inferred based on the latter.
Emission parameters. The emission parameters for each latent state are shown in Figure 5. By construction (Section 2.3.1), higher states correspond to greater probabilities of specific comorbidities, revealing clusters of conditions that tend to co-occur:
| Model | Men < 65 | Women < 65 | Men 65+ | Women 65+ | ||||
|---|---|---|---|---|---|---|---|---|
| BIC | AIC | BIC | AIC | BIC | AIC | BIC | AIC | |
| 329077 | 314469 | 236219 | 221959 | 234704 | 220497 | 212736 | 198738 | |
| 310663 | 307445 | 225526 | 222385 | 229629 | 226500 | 203633 | 200550 | |
| 292039 | 286438 | 216236 | 210769 | 221682 | 216235 | 195206 | 189839 | |
| 293949 | 285052 | 211923 | 203239 | 220663 | 212010 | 195312 | 186787 | |
| 264231 | 256136 | 190847 | 182946 | 201848 | 193976 | 181320 | 173563 | |
| 273908 | 260869 | 196096 | 183369 | 196499 | 183819 | 181122 | 168628 | |
| 273337 | 262748 | 178959 | 168623 | 181179 | 170881 | 162739 | 152592 | |
| 276474 | 270739 | 211039 | 192272 | 186698 | 188498 | 174079 | 168585 | |
Table 3: Comparison between models with various number of chains. Metrics are evaluated on the validation set and drugs are not used as input.

Figure 5: Top: Emission parameters modeling the risk of developing a comorbidity for a given state. Larger values indicate a higher probability of having the comorbidity. The values are reported on a logarithmic scale. Bottom: Mean value of lab tests with respect to the intercept (i.e., state 0). Red (resp. blue) indicates an increase (resp. decrease) in relative to the intercept. The model includes 8 chains with 4 states per chain and is fitted on on Women < 65.
-
Chain 0, termed "Osteoporosis progression," combines elevated risks of osteoporosis, chronic kidney disease and fatty liver disease with a high-HDL/LDL and low-triglyceride profile.
-
Chain 1, "Cardiovascular progression," captures macrovascular outcomes (peripheral vascular disease, heart failure, death) and renal failure (low GFR), along with osteoporosis.
-
Chain 2, "Infarction progression," is marked by myocardial infarction risk accompanied by BMI reduction.
-
Chain 3, "Metabolic syndrome progression," features obesity, dyslipidemia, chronic obstructive pulmonary disease, liver disease and death risk.
-
Chain 4, "Hypertension progression," reflects isolated elevation of systolic and diastolic blood pressure.

Figure 6: Estimated contribution of drug prescriptions to initial latent state allocation ( ), based on a model with 8 chains and 4 states per chain fitted to the Women < 65 subgroup. Higher values indicate a greater probability of starting in a more severe latent state. These estimates capture baseline correlations, not causal effects, since they describe state assignment rather than counterfactual deviation.
• Chain 5, "Retinopathy progression," shows increased diabetic retinopathy probability alongside poor glycemic and lipid control (elevated HbA1c, triglycerides and BMI, reduced HDL).
• Chain 6, "Vascular progression," combines stroke, peripheral vascular disease and COPD with a comparatively favorable lipid profile.
• Chain 7, "Cardiorenal progression," integrates myocardial infarction, stroke, chronic heart failure, chronic kidney disease and dyslipidemia with obesity. Hypertension and diabetic retinopathy tend to develop independently of other comorbidities in our model.
Initial latent state. The relationship between the initial latent state and the input variables is shown in Figure 6. Positive values (in red) correspond to a higher probability of beginning in a more severe state. Smoking shows a marked positive value in chain 3, reflecting its association with increased COPD risk. The age parameter is positive across several chains, indicating that older patients tend to start in worse health states. This pattern is not observed in chain 5, where age has no significant effect on the initial state. Receiving treatment for bone diseases is associated with an increased likelihood of being in the osteoporosis state at the start.
State Clustering. Following Section 2.5, we identified 13 clusters in the latent representation according to the selection criterion (see Figure 12 in the Appendix). Table 4 details the baseline characteristics of each cluster at NIAD initiation, and Figure 7 presents their time-averaged clinical profiles.
Several clusters demonstrate similarities at NIAD initiation. Clusters 0, 1, and 11 share characteristics of younger patients (age < 50) with low comorbidity burden. However, their clinical trajectories differ significantly - particularly cluster 1, which despite its younger profile shows higher smoking prevalence, elevated BMI, and increased mortality risk (see Table 4).
The clusters can be divided based on their mortality risk. At one end of the spectrum, clusters 0, 2, 4, 5, and 11 form a lower-risk group characterized by relatively low death rates. An intermediate category includes clusters 1, 9, and 10, which show progressing disease with moderate mortality risk. The highest-risk group comprises clusters 3, 6, 7, 8, and 12, showing substantially elevated mortality rates that indicate advanced disease states. Within this high-risk category, cluster 7 is particularly notable: it is defined by the highest BMI (morbid obesity with BMI > 40) and carries an exceptionally high comorbidity burden, indicating particularly severe disease progression.
The healthiest subgroup, cluster 0 ("young low-risk"), is characterized by preserved metabolic and renal function and low cardiovascular risk. Cluster 3 ("pulmonary-metabolic") combines metabolic dysfunction and pulmonary disease with high smoking prevalence and renal impairment. This cluster's
| Cluster | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| # of patients | 3373 | 1468 | 1549 | 792 | 2774 | 1491 | 1101 | 1431 | 1006 | 1421 | 594 | 1143 | 1362 |
| Avg. age at NIAD (y) ± SD | 47.01 ± 10.68 | 47.1 ± 10.3 | 54.01 ± 7.19 | 57.49 ± 6.09 | 54.27 ± 7.5 | 54.53 ± 8.24 | 54.61 ± 7.71 | 55.52 ± 7.38 | 56.12 ± 7.1 | 53.19 ± 7.93 | 57.12 ± 6.27 | 48.75 ± 9.98 | 55.23 ± 7.86 |
| Avg. follow-up post-NIAD (y) ± SD | 3.73 ± 2.68 | 4.52 ± 2.98 | 5.88 ± 3.15 | 4.87 ± 2.99 | 4.63 ± 3.13 | 5.23 ± 3.28 | 5.23 ± 3.19 | 6.21 ± 3.27 | 5.37 ± 3.24 | 5.81 ± 3.25 | 6.79 ± 3.23 | 5.08 ± 3.0 | 6.52 ± 3.35 |
| Avg. BMI at NIAD (kg/m2) ± SD | 33.15 ± 7.55 | 37.25 ± 7.79 | 34.07 ± 6.16 | 35.74 ± 7.81 | 34.54 ± 6.94 | 34.31 ± 6.73 | 35.04 ± 6.93 | 40.96 ± 9.87 | 36.64 ± 7.38 | 38.35 ± 7.72 | 31.23 ± 6.45 | 32.96 ± 6.62 | 38.04 ± 8.34 |
| Avg. HbA1c at NIAD (%) ± SD | 6.83 ± 1.56 | 7.26 ± 1.66 | 7.48 ± 1.61 | 7.24 ± 1.47 | 6.89 ± 1.37 | 7.15 ± 1.49 | 7.25 ± 1.48 | 7.51 ± 1.61 | 7.35 ± 1.5 | 7.05 ± 1.46 | 7.16 ± 1.59 | 7.94 ± 1.83 | 6.92 ± 1.37 |
| % Ever smoked | 23.04 | 79.56 | 20.46 | 78.41 | 20.01 | 29.51 | 43.23 | 56.81 | 55.07 | 59.25 | 30.13 | 24.41 | 50.07 |
| % Ever alcohol | 70.53 | 82.63 | 85.15 | 85.61 | 78.98 | 79.61 | 82.29 | 84.35 | 82.9 | 86.77 | 82.15 | 82.06 | 82.53 |
| Comorbidities at NIAD [N, (%)] | |||||||||||||
| Stroke | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 294 (19.72) | < 1 % | 178 (12.44) | < 1 % | < 1 % | < 1 % | < 1 % | 104 (7.64) |
| Myocardial infarction | < 1 % | < 1 % | < 1 % | 16 (2.02) | < 1 % | < 1 % | 12 (1.09) | 158 (11.04) | < 1 % | < 1 % | < 1 % | < 1 % | 171 (12.56) |
| Congestive heart failure | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 49 (3.29) | < 1 % | 89 (6.22) | < 1 % | < 1 % | < 1 % | < 1 % | 50 (3.67) |
| Peripheral vascular disease | < 1 % | < 1 % | < 1 % | 43 (5.43) | < 1 % | 19 (1.27) | < 1 % | 25 (1.75) | < 1 % | < 1 % | 65 (10.94) | < 1 % | < 1 % |
| Diabetic retinopathy | < 1 % | 116 (7.90) | 520 (33.57) | 118 (14.90) | < 1 % | 213 (14.29) | 188 (17.08) | 436 (30.47) | 191 (18.99) | 69 (4.86) | 67 (11.28) | 445 (38.93) | < 1 % |
| Hypertension | 79 (2.34) | 23 (1.57) | 1155 (74.56) | 384 (48.48) | 2230 (80.39) | 821 (55.06) | 593 (53.86) | 938 (65.55) | 769 (76.44) | 1113 (78.33) | 288 (48.48) | < 1 % | 843 (61.89) |
| Chronic kidney disease | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 399 (26.76) | 18 (1.63) | 191 (13.35) | < 1 % | < 1 % | < 1 % | < 1 % | 170 (12.48) |
| Osteoporosis | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 35 (2.35) | 65 (5.90) | 20 (1.40) | < 1 % | < 1 % | 150 (25.25) | < 1 % | < 1 % |
| COPD | < 1 % | < 1 % | < 1 % | 497 (62.75) | < 1 % | < 1 % | 78 (7.08) | 149 (10.41) | < 1 % | < 1 % | 6 (1.01) | < 1 % | 82 (6.02) |
| Chronic liver disease | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 531 (48.23) | 65 (4.54) | < 1 % | < 1 % | < 1 % | < 1 % | 39 (2.86) |
| Comorbidities during follow-up [N, (%)] | |||||||||||||
| Stroke | < 1 % | < 1 % | < 1 % | 10 (1.26) | < 1 % | 102 (6.84) | 14 (1.27) | 59 (4.12) | < 1 % | < 1 % | 14 (2.36) | < 1 % | 58 (4.26) |
| Myocardial infarction | < 1 % | < 1 % | < 1 % | 10 (1.26) | < 1 % | < 1 % | 11 (1.00) | 27 (1.89) | < 1 % | 20 (1.41) | < 1 % | < 1 % | 29 (2.13) |
| Congestive heart failure | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 31 (2.08) | < 1 % | 59 (4.12) | < 1 % | < 1 % | 6 (1.01) | < 1 % | 55 (4.04) |
| Peripheral vascular disease | < 1 % | < 1 % | < 1 % | 20 (2.53) | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 22 (3.70) | < 1 % | < 1 % |
| Diabetic retinopathy | 163 (4.83) | 224 (15.26) | 610 (39.38) | 166 (20.96) | 202 (7.28) | 283 (18.98) | 222 (20.16) | 462 (32.29) | 219 (21.77) | 247 (17.38) | 153 (25.76) | 486 (42.52) | 176 (12.92) |
| Hypertension | 126 (3.74) | 36 (2.45) | 175 (11.30) | 66 (8.33) | 309 (11.14) | 138 (9.26) | 70 (6.36) | 76 (5.31) | 76 (7.55) | 148 (10.42) | 72 (12.12) | 40 (3.50) | 89 (6.53) |
| Chronic kidney disease | < 1 % | < 1 % | < 1 % | 13 (1.64) | < 1 % | 166 (11.13) | 39 (3.54) | 124 (8.67) | < 1 % | < 1 % | 21 (3.54) | < 1 % | 88 (6.46) |
| Osteoporosis | < 1 % | < 1 % | < 1 % | 15 (1.89) | < 1 % | 19 (1.27) | 21 (1.91) | < 1 % | < 1 % | < 1 % | 50 (8.42) | < 1 % | < 1 % |
| COPD | < 1 % | 31 (2.11) | < 1 % | 136 (17.17) | < 1 % | 15 (1.01) | 49 (4.45) | 94 (6.57) | 29 (2.88) | 46 (3.24) | 11 (1.85) | < 1 % | 58 (4.26) |
| Chronic liver disease | < 1 % | 28 (1.91) | < 1 % | 8 (1.01) | < 1 % | 16 (1.07) | 296 (26.88) | 75 (5.24) | 26 (2.58) | 36 (2.53) | 19 (3.20) | 14 (1.22) | 49 (3.60) |
| Deaths before 2020 | < 1 % | 42 (2.86) | < 1 % | 79 (9.97) | < 1 % | 21 (1.41) | 60 (5.45) | 132 (9.22) | 148 (14.71) | 30 (2.11) | 12 (2.02) | < 1 % | 93 (6.83) |
Table 4: Patient characteristics in each cluster for the Women < 65 cohort with average values and standard deviation where applicable. Comorbidities are presented as absolute counts at NIAD initiation, along with the number of new comorbidities developed post-NIAD. Proportions, expressed as percentages of the cohort population, are reported in parentheses.
profile, with increased risk in nearly all comorbidities, positions it as a transition toward severe multimorbidity. On the other hand, cluster 10 ("bone-vascular") features high osteoporosis prevalence and increased peripheral vascular disease, suggesting shared pathophysiological pathways between skeletal and vascular systems.
Among the most severe phenotypes, cluster 8 ("advanced nephropathy") shows severe GFR loss, persistent hypertension, and high mortality. Cluster 12 ("cardio-pulmonary multimorbidity") is defined by COPD, CHF, and elevated stroke risk. Cluster 6 ("hepatorenal syndrome") represents a very severe situation, linking chronic liver disease, renal dysfunction (low GFR), and poor glycemic control, consistent with fatty liver disease trends [24].
State progression. The temporal distribution of the clusters is shown in Figure 8. Clusters associated with advanced or progressing disease (e.g., cluster 7 and transitional clusters 2, 6, 10, 12) gain members over time, while healthier clusters (0, 1, 4) decline.
Figure 9 presents the cumulative incidence functions for time to first cluster transition, stratified by initial cluster assignment. The transition dynamics are further illustrated in the appendix (Figure 13). Patients in cluster 0 often progress into early microvascular states, particularly cluster 11 or cluster 4, defined by higher prevalence of diabetic retinopathy and hypertension, respectively. After approximately four years, these states may progress to early multimorbidity (cluster 5) or a combination of both diseases (cluster 2), as confirmed by Figure 9 showing most cluster 4 patients transitioning to cluster 2. In contrast, cluster 1, despite representing younger patients, exhibits higher mortality risk and demonstrates progression to advanced disease states. These patients typically evolve into clusters 6 or 7 in later stages, indicating more severe disease trajectories.
Cluster 10 (bone-vascular) represents an intermediate severity profile. Patients in this cluster tend to progress toward broader multimorbidity through two primary pathways: either via clusters 2 or 5, or occasionally involving hepatic complications (cluster 6). The advanced disease profiles represented by cluster 12 (cardio-pulmonary multimorbidity) typically transition to cluster 7, the most severe multimorbid state, that serves as a frequent absorbing state. Similarly, clusters 2, 5, and 11 demonstrate low transition probabilities, functioning as stable states where patients tend to remain over time (at least when starting in those clusters).
The transition graph in Figure 10 (showing only transitions with less than probability) reveals that clusters 0, 2, 4, 5, 10, and 11 form a transient subgraph. This configuration indicates that once patients transition out of these clusters, they rarely return, suggesting a unidirectional progression toward more severe disease states. The observed pattern reflects the clinical reality that as patients develop serious comorbidities, their condition tends to evolve toward increasingly complex and severe multimorbidity profiles rather than reverting to less severe states.

Figure 7: Average cluster-specific probabilities and lab values for Women < 65. Values have been centered by subtracting the average at the time of NIAD initiation to improve readability. Red bars indicate increases, and blue bars indicate decreases relative to the average patient at NIAD. Comorbidity risks are shown as changes in probability (left axis), and lab values as percentage changes relative to the reference value (right axis). Annotated numbers indicate absolute changes in the original units (see Table 1). Error bars represent the standard error of the mean.
4 Discussion
We identified eight latent components that capture distinct patterns of comorbidity in type 2 diabetes in women under 65 years of age (with additional population analyses provided in the Appendix). At the interpretation level, the inferred latent chains correspond to recognizable diabetes-related complications, spanning microvascular, macrovascular, metabolic, skeletal, pulmonary, and cardiorenal involvement. Several components reflect well-established comorbidity patterns in T2DM; for example, chains dominated by macrovascular and renal outcomes align with the known coupling between cardiovascular disease and chronic kidney disease in diabetes, often described as a cardiorenal syndrome [26]. Similarly, components emphasizing microvascular complications, such as retinopathy and hypertension, appear to develop independently of other complications and follow expected clinical patterns, including associations with elevated blood pressure and poor glycemic and lipid control, respectively [27, 28]. The skeletal involve-

Figure 8: Distribution of the clusters over time.
ment in our osteoporosis-related component co-occurred with chronic kidney and liver disease, reflecting the clustering of multisystem complications in T2DM. This pattern is consistent with the understanding that diabetes affects multiple organ systems through interconnected metabolic and vascular pathways [29, 30].
While many of these associations are individually well documented, our model learns them jointly from longitudinal data without prespecifying disease groupings or assuming independence between outcomes. This yields an interpretable decomposition of multimorbidity into parallel disease processes that may co-occur and progress at different rates within individuals.
At the patient level, clustering of latent-state trajectories highlights how these components combine into progression pathways. Patients often transition from relatively healthy or low-risk metabolic states (clusters 0, 2, 4, 5, 10, 11) toward advanced multimorbid states, with clusters 6 and 7 representing terminal disease profiles associated with elevated mortality. These trajectories broadly separate into at least two modes of progression: one dominated by microvascular complications (clusters 2, 4, 5, 10, 11), and another driven by pulmonary, hepatic, renal, and cardio-pulmonary involvement (clusters 3, 6, 8, 9, 12).
From a methodological perspective, our model reveals patterns that are difficult to extract with alternative approaches. While static clustering approaches summarize patient similarity but do not encode temporal dynamics [12], and deep generative models can learn flexible latent representations from longitudinal clinical data but often require additional assumptions or post hoc alignment to relate latent dimensions to clinical concepts [9], our approach provides a structured factorization that enables direct clinical interpretation. Classical HMM-based models capture temporal dynamics but often rely on a single latent process, potentially mixing distinct disease mechanisms [3, 4]. The factorial structure adopted here enables multimorbidity to be represented as the superposition of multiple latent chains, providing a natural framework for chronic diseases characterized by overlapping and asynchronous complications.
This study has several limitations. Real-world electronic health records are collected based on routine clinical care, resulting in unequally spaced measurements that often required forward imputation to maintain complete information at each time-point. Some variables, particularly BMI and other lifestyle variables, exhibit missingness that is likely not missing at random. While forward imputation avoids using future information, alternative imputation schemes might be more appropriate for handling missing values. The current model uses Gaussian emissions for scalability, though extensions to other distributions (e.g., count-based likelihoods) are possible. The data were grouped into binned time steps, imposing an assumption of regular observation intervals that does not reflect the irregular nature of real-world measurements. The analysis was restricted to a relatively small set of commonly occurring chronic comorbidities and laboratory values, excluding less frequent conditions that might contribute to multimorbidity patterns. Issues of data imbalance persist, as many comorbidities represent rare events, and treatment adherence was not explicitly modeled, adding uncertainty to treatment-related effects. Finally, the requirement for HbA1c measurements prior to the index date may introduce selection bias, as tested individuals are more likely to have suspected or established comorbidities. As a result, the study cohort may represent a systematically sicker subset of the broader population, potentially limiting generalizability.

Figure 9: Cumulative Incidence Function (CIF) for the time to first cluster transition in Women < 65, stratified by initial cluster assignment at 6 months post-NIAD. The estimates account for censoring due to loss to follow-up and study termination, computed using the Aalen nonparametric estimator [25].
5 Conclusion
Our study demonstrates that comorbidities in T2DM can be effectively modeled as the interaction of multiple latent disease processes evolving over time. The structural FHMM approach identified eight coherent latent components that explain the different disease trajectories, providing insights into the complex progression patterns of T2DM and its complications.

Figure 10: Transition graph. Red arrows (resp. blue) means an increase (resp. decrease) of the comorbidity risk (Women < 65). Arrow thickness is proportional to the number of observed transitions. Transitions with less than 1% probability are not shown.
The advantages of our approach include its ability to learn meaningful patterns of comorbidities jointly from longitudinal data, without requiring pre-specified disease groupings. This makes it broadly applicable, particularly in contexts where prior knowledge is unavailable or cannot be encoded. The model captures temporal dynamics often missed by static clustering approaches and delivers more interpretable results compared to deep generative models. The factorial structure allows for the representation of comorbidities as a superposition of multiple concurrent disease processes, offering a better understanding of disease progression than single-process HMMs.
Looking forward, several directions could improve the clinical utility of this approach. While our model effectively characterizes T2DM progression patterns, real-time clinical implementation would require incorporation of additional comorbidities beyond the core set analyzed. Although prescribed medications were included in our initial analysis, they did not significantly improve model performance, likely due to challenges in capturing complex treatment patterns from EHR data. Future work could explore more sophisticated feature engineering of medication data. Nevertheless the interpretability demonstrated by our approach suggests strong potential for integration into real-world clinical workflows, where it could provide valuable insights into disease progression patterns and inform personalized care strategies for T2DM patients.
6 Funding
This research was funded by a Swiss Data Science Centre Collaboration Grant (C19-09).
References
[1] D. Tomic, J. E. Shaw, and D. J. Magliano, “The burden and risks of emerging complications of diabetes mellitus,” Nature Reviews Endocrinology, vol. 18, pp. 525–539, Sep 2022.
[2] Z. Ghahramani and M. Jordan, “Factorial hidden markov models,” Advances in Neural Information Processing Systems, vol. 8, 1995.
[3] A. M. Alaa, S. Hu, and M. Schaar, “Learning from clinical judgments: Semi-markov-modulated marked hawkes processes for risk prognosis,” in International Conference on Machine Learning, pp. 60–69, PMLR, 2017.
[4] X. Wang, D. Sontag, and F. Wang, “Unsupervised learning of disease progression models,” in Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 85–94, 2014.
[5] O. Ben-Assuli, T. Heart, J. R. Vest, R. Ramon-Gonen, N. Shlomo, and R. Klempfner, “Profiling readmissions using hidden markov model—the case of congestive heart failure,” Information Systems Management, vol. 38, no. 3, pp. 237–249, 2021.
[6] Y.-Y. Liu, S. Li, F. Li, L. Song, and J. M. Rehg, “Efficient learning of continuous-time hidden markov models for disease progression,” Advances in neural information processing systems, vol. 28, 2015.
[7] T. Ceritli, A. P. Creagh, and D. A. Clifton, “Mixture of input-output hidden markov models for heterogeneous disease progression modeling,” in Workshop on Healthcare AI and COVID-19, pp. 41–53, PMLR, 2022.
[8] F. J. Ruiz, I. Valera, C. Blanco, and F. Perez-Cruz, “Bayesian nonparametric comorbidity analysis of psychiatric disorders,” The Journal of Machine Learning Research, vol. 15, no. 1, pp. 1215–1247, 2014.
[9] C. Trottet, M. Schürch, A. Mollaysa, A. Allam, and M. Krauthammer, “Generative time series models with interpretable latent processes for complex disease trajectories,” in Deep Generative Models for Health Workshop NeurIPS 2023, 2023.
[10] Z. Oflaz, C. Yozgatligil, and A. S. Selcuk-Kestel, “Modeling comorbidity of chronic diseases using coupled hidden markov model with bivariate discrete copula,” Statistical Methods in Medical Research, p. 09622802231155100, 2023.
[11] L. Fregoso-Aparicio, J. Noguez, L. Montesinos, and J. A. García-García, “Machine learning and deep learning predictive models for type 2 diabetes: a systematic review,” Diabetology & Metabolic Syndrome, vol. 13, no. 1, pp. 1–22, 2021.
[12] A. Martinez-De la Torre, F. Perez-Cruz, S. Weiler, and A. M. Burden, “Comorbidity clusters associated with newly treated type 2 diabetes mellitus: a bayesian nonparametric analysis,” Scientific Reports, vol. 12, no. 1, p. 20653, 2022.
[13] R. R. Kalyani, S. H. Golden, and W. T. Cefalu, “Diabetes and aging: Unique considerations and goals of care,” Diabetes Care, vol. 40, no. 4, pp. 440–443, 2017.
[14] G. T. Russo, A. Giandalia, E. L. Romeo, M. Nunziata, M. Muscianisi, M. C. Ruffo, A. Catalano, and D. Cucinotta, “Fracture risk in type 2 diabetes: Current perspectives and gender differences,” International Journal of Endocrinology, vol. 2016, p. 1615735, 2016.
[15] R. Schweiger, Y. Erlich, and S. Carmi, “FactorialHMM: fast and exact inference in factorial hidden Markov models,” Bioinformatics, vol. 35, pp. 2162–2164, 11 2018.
[16] J. Chiquet, Y. Grandvalet, and C. Charbonnier, “Sparsity with sign-coherent groups of variables via the cooperative-lasso,” The Annals of Applied Statistics, vol. 6, no. 2, pp. 795–830, 2012.
[17] M. Yuan and Y. Lin, “Model selection and estimation in regression with grouped variables,” Journal of the Royal Statistical Society: Series B (Statistical Methodology), vol. 68, no. 1, pp. 49–67, 2006.
[18] M. J. Wainwright and M. I. Jordan, “Graphical Models, Exponential Families, and Variational Inference,” Foundations and Trends in Machine Learning, vol. 1, pp. 1–305, Jan. 2008.
[19] T. S. Jaakkola and M. I. Jordan, “A variational approach to Bayesian logistic regression models and their extensions,” in Proceedings of the Sixth International Workshop on Artificial Intelligence and Statistics (D. Madigan and P. Smyth, eds.), vol. R1 of Proceedings of Machine Learning Research, pp. 283–294, PMLR, 04–07 Jan 1997. Reissued by PMLR on 30 March 2021.
[20] D. L. Davies and D. W. Bouldin, “A cluster separation measure,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. PAMI-1, no. 2, pp. 224–227, 1979.
[21] R. Tibshirani and G. Walther, “Cluster validation by prediction strength,” Journal of Computational and Graphical Statistics, vol. 14, no. 3, pp. 511–528, 2005.
[22] H. Akaike, “A new look at the statistical model identification,” IEEE Transactions on Automatic Control, vol. 19, no. 6, pp. 716–723, 1974.
[23] G. Schwarz, “Estimating the dimension of a model,” The Annals of Statistics, vol. 6, no. 2, pp. 461–464, 1978.
[24] Z. M. Younossi, A. B. Koenig, D. Abdelatif, Y. Fazel, L. Henry, and M. Wymer, “Global epidemiology of nonalcoholic fatty liver disease—meta-analytic assessment of prevalence, incidence, and outcomes,” Hepatology, vol. 64, no. 1, pp. 73–84, 2016.
[25] O. Aalen, “Nonparametric estimation of partial transition probabilities in multiple decrement models,” The Annals of Statistics, vol. 6, no. 3, pp. 534–545, 1978.
[26] C. Ronco, P. McCullough, S. D. Anker, I. Anand, N. Aspromonte, S. M. Bagshaw, R. Bellomo, T. Berl, I. Bobek, D. Cruz, et al., “Cardiorenal syndrome,” Journal of the American College of Cardiology, vol. 52, no. 19, pp. 1527–1539, 2008.
[27] N. Cheung, P. Mitchell, and T. Y. Wong, “Diabetic retinopathy,” Lancet, vol. 376, pp. 124–136, July 2010. Epub 2010 Jun 26.
[28] R. Lee, T. Y. Wong, and C. Sabanayagam, “Epidemiology of diabetic retinopathy, diabetic macular edema and related vision loss,” Eye and Vision (London, England), vol. 2, p. 17, 2015.
[29] P. Vestergaard, “Discrepancies in bone mineral density and fracture risk in patients with type 1 and type 2 diabetes—a meta-analysis,” Osteoporosis International, vol. 18, pp. 427–444, Apr. 2007.
[30] N. Napoli, M. Chandran, D. D. Pierroz, B. Abrahamsen, A. V. Schwartz, and S. L. Ferrari, “Mechanisms of diabetes mellitus-induced bone fragility,” Nature Reviews Endocrinology, vol. 13, pp. 208–219, Apr. 2017.
A Data preparation
| Lab Value | Low | High | Comment |
|---|---|---|---|
| Glomerular filtration rate | 0 | 150 | - |
| Hb A1C | 0 | 16 | - |
| High Density Lipoprotein | 0 | 5 | - |
| Low Density Lipoprotein | 0 | 10 | - |
| Triglycerides | 0 | 15 | - |
| BMI | 0 | 80 | - |
| Diastolic | 30 | 150 | Lower than systolic |
| Systolic | 80 | 240 | Higher than diastolic |
Table 5: Predefined thresholds used to remove outliers. Values are removed if they are not included in the lower and upper limits.
| Men < 65 | Men 65+ | Women < 65 | Women 65+ | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Train | Val | Test | Train | Val | Test | Train | Val | Test | Train | Val | Test | |
| COPD | 7.7 | 7.6 | 8.0 | 16.4 | 16.1 | 17.0 | 7.8 | 7.9 | 7.9 | 13.3 | 12.8 | 15.6 |
| Diabetic retinopathy | 32.8 | 33.4 | 32.9 | 34.8 | 36.3 | 36.4 | 30.4 | 31.5 | 31.1 | 34.6 | 33.8 | 35.7 |
| Hypertension | 59.5 | 59.7 | 61.3 | 71.2 | 71.0 | 71.9 | 56.9 | 57.0 | 57.1 | 78.6 | 79.9 | 79.2 |
| Myocardial infarction | 8.8 | 9.2 | 9.0 | 16.6 | 17.1 | 18.5 | 3.0 | 2.8 | 2.8 | 7.9 | 6.8 | 7.3 |
| Peripheral vascular disease | 4.2 | 3.8 | 4.5 | 11.0 | 11.1 | 10.5 | 1.7 | 1.8 | 1.6 | 5.5 | 6.2 | 5.7 |
| Stroke | 6.2 | 6.4 | 6.7 | 17.6 | 17.6 | 17.6 | 5.1 | 5.1 | 5.0 | 15.8 | 14.2 | 14.4 |
| Osteoporosis | 0.7 | 0.6 | 0.7 | 2.2 | 2.3 | 2.1 | 2.9 | 3.1 | 2.6 | 11.8 | 11.8 | 11.8 |
| Chronic kidney disease | 5.9 | 5.9 | 5.9 | 11.5 | 12.7 | 10.7 | 6.9 | 6.5 | 6.5 | 10.3 | 9.1 | 9.6 |
| Chronic liver disease | 4.8 | 4.8 | 4.8 | 2.7 | 2.4 | 3.3 | 6.2 | 6.2 | 6.2 | 2.9 | 3.5 | 3.3 |
| Congestive heart failure | 4.5 | 4.5 | 4.5 | 13.3 | 14.0 | 14.2 | 2.3 | 2.2 | 2.4 | 10.6 | 10.6 | 10.5 |
| Death | 5.2 | 5.4 | 5.2 | 22.3 | 22.2 | 22.2 | 4.1 | 4.1 | 3.9 | 19.4 | 19.1 | 20.1 |
Table 6: Number of patient diagnosed with the comorbidity for each data split. Numbers are given in percentage.
B Variational approximation
This section provides details on the fitting algorithm used to train the FHMM. The fitting algorithm mainly follows [2], where the authors reduce the inference complexity to by exploiting a structured mean field variational approximation [18] for the posterior distribution used in the E step of their EM procedure. In particular, due to their specific choice, (6) can be written as
where and are respectively normalizing constants of and and where is a one-hot encoded version of .
The E step requires the optimization of the parameters , which can be computing by solving
where the gradient is
The M step requires the optimization of with respect to . Each parameter can be optimized individually by solving
(10)
where
\begin{align*}\gamma_{t}^{(m)}&\stackrel{\mathrm{def}}{=}\mathbb{E}_{q_{\phi}}\left[\tilde{H}_{t}^{(m)}\right]\in\mathbb{R}^{K},\\\xi_{t}^{(m)}&\stackrel{\mathrm{def}}{=}\mathbb{E}_{q_{\phi}}\left[\tilde{H}_{t}^{(m)}\tilde{H}_{t-1}^{(m)}^{\top}\right]\in\mathbb{R}^{K\times K},\end{align*}are computed using the Baum–Welch algorithm for HMMs (see [2]), whose complexity is .
Equations (9) and (10) involves expectations that are expensive to compute. In particular, it requires the computation of for any , which has a memory and computational complexity of . Inspired by the Gaussian case, for which analytical expressions exists (see [2]), a second order approximation of the emission log-likelihood is derived using the inequality (8). In that case, the gradient is reduced to
(11)
Finding the zeros of (11) (E step) can then be easily done without computing the expensive terms . On the other hand, the M step for binary outputs becomes
(12)
where and . Note that Equation 12 is a lower bound of the ELBO, which can be optimized with respect to , which admits a closed form solution
C Input medications
When drugs are used as input, the entries of the matrix are given
where and . This parametrization captures the fact that drugs can either add probability mass on lower state values ( ) or add probability mass on higher state values ( ). It is important to note that adding probability mass to lower state values will automatically reduce the probability mass on higher state values, and vice versa. In addition, , follow a priori a Gaussian distribution centered at 0, which is equivalent to add the penalizations to the objective function. The underlying assumptions is that the drug effect is a priori small (i.e., is likely to be small).
Table 7 shows the performance of the model when drugs are used as input. The use of drugs in the model, is marginal and it does not improve the BIC score. The AIC is improved in few cases. Figure 11 show how the input variables affect the evolution of the latent state for the model FHMM(8, 4) fitted on the male population younger than 65. Age generally has a negative effect on chain transitions, increasing the probability of moving to a worsening state. Smoking also accelerates progression along chain 4, which is associated with a higher risk of COPD. The use of calcium channel blockers is linked to chain 5, which models hypertension. Here we observe an apparent worsening effect, although this may simply reflect that the model associates higher states with greater use of calcium channel blockers. By contrast, the addition of a new antidiabetic drug typically produces a positive effect on the patient's state.
| Category | Metric Model | BIC | AIC | ||
|---|---|---|---|---|---|
| Drugs | No Drugs | Drugs | No Drugs | ||
| Men < 65 | 315914 | 310663 | 308086 | 307445 | |
| 308458 | 292039 | 294662 | 286438 | ||
| 291660 | 264231 | 271273 | 256136 | ||
| 280861 | 273337 | 253882 | 262748 | ||
| 286149 | 276474 | 270171 | 270739 | ||
| Women < 65 | 231096 | 225526 | 223455 | 222385 | |
| 231223 | 216236 | 217757 | 210769 | ||
| 212362 | 190847 | 192462 | 182946 | ||
| 203653 | 178959 | 177320 | 168623 | ||
| 218704 | 211039 | 203108 | 205441 | ||
| Men 65+ | 229811 | 229629 | 222198 | 226500 | |
| 228468 | 221682 | 215051 | 216235 | ||
| 218800 | 201848 | 198973 | 193976 | ||
| 203550 | 181179 | 177312 | 170881 | ||
| 204037 | 192274 | 188498 | 186698 | ||
| Women 65+ | 208526 | 203633 | 201026 | 200550 | |
| 204033 | 195206 | 190813 | 189839 | ||
| 195974 | 181320 | 176439 | 173563 | ||
| 180633 | 162739 | 154781 | 152592 | ||
| 184247 | 174079 | 168937 | 168585 | ||
Table 7: Comparison between models with drugs and without drugs. Metrics are evaluated on the validation set.
D Additional Figures
The number of clusters is determined using the Davies-Bouldin index [20] and the prediction strength introduced by [21]. The prediction strength is estimated using a 3-fold cross-validation setup, where two-thirds of the data is used for training and one-third for testing.

Figure 11: Top: Average effect of drugs on the transition matrix, estimated as . Red (resp. blue) means an increase of the probability to transition to a higher (resp. lower) state value. Bottom: Emission parameters modeling the risk of developing a comorbidity for a given state. Larger values indicate a higher probability of having the comorbidity. The model includes 8 chains with 4 states per chain and is fitted on Men < 65.

Figure 12: Cluster selection using Davies-Bouldin index and the prediction strength. The optimal number of cluster is indicated by the black dashed line. This is fitted on the population of Women < 65.
Cluster Evolution starting from 0

Cluster Evolution starting from 4
Cluster Evolution starting from 2

Cluster Evolution starting from 10
Cluster Evolution starting from 11

Cluster Evolution starting from 3

Cluster Evolution starting from 6
Cluster Evolution starting from 10

Cluster Evolution starting from 8
Cluster Evolution starting from 3
Cluster Evolution starting from 9

Cluster 6

Cluster Evolution starting from 12
Cluster 3
Cluster 6
Cluster 8
Cluster 9

Cluster Evolution starting from 12
Cluster 7
Cluster 12

Figure 13: Evolution of patient clusters 0 (healthy), 2 (pathway to multimorbidity), 3 (pulmonary-metabolic), 4 (isolated hypertension), 6 (hepatic), 8 (advanced nephropathy), 9 (obese hypertension), 10 (bone-vascular), 11 (isolated DR), and 12 (cardio-pulmonary multimorbidity) over time (Women < 65), conditional on the initial cluster assignment (6 months post-NIAD). The number of patients in each cluster is indicated alongside the corresponding bars. For clarity, flows representing less than 1% of the initial cluster size, as well as transitions to no available follow-up data, are not displayed. Clusters 1, 5, and 7 are excluded due to the low number of transitions observed from these clusters.
E Male < 65
| Cluster | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| # of patients | 6504 | 1788 | 1698 | 1166 | 3911 | 1522 | 360 | 1212 | 957 | 1534 | 1010 | 1511 | 1070 | 703 | 685 |
| Avg. age at NIAD (y) ± SD | 50.88 ± 8.68 | 53.66 ± 8.11 | 55.28 ± 6.95 | 57.41 ± 6.39 | 53.89 ± 7.32 | 56.18 ± 6.73 | 58.28 ± 5.63 | 53.21 ± 7.78 | 57.69 ± 5.92 | 57.42 ± 6.14 | 55.41 ± 7.21 | 51.53 ± 8.35 | 56.68 ± 6.42 | 55.89 ± 7.02 | 54.0 ± 7.97 |
| Avg. follow-up post-NIAD (y) ± SD | 4.28 ± 3.1 | 6.85 ± 3.25 | 5.78 ± 2.86 | 5.38 ± 3.11 | 4.72 ± 3.22 | 6.52 ± 3.27 | 4.49 ± 2.89 | 5.97 ± 3.06 | 5.46 ± 3.59 | 5.58 ± 3.57 | 3.63 ± 2.85 | 5.29 ± 2.75 | 6.25 ± 2.88 | 5.05 ± 3.08 | 6.29 ± 2.64 |
| Avg. BMI at NIAD (kg/m) ± SD | 30.85 ± 5.52 | 34.96 ± 6.67 | 31.58 ± 4.79 | 34.31 ± 6.68 | 32.47 ± 5.32 | 30.86 ± 4.48 | 32.25 ± 6.67 | 43.79 ± 5.7 | 32.82 ± 4.93 | 33.54 ± 4.23 | 33.08 ± 6.39 | 30.38 ± 4.95 | 36.46 ± 6.85 | 32.01 ± 6.18 | 34.96 ± 6.77 |
| Avg. HbA1c at NIAD (%) ± SD | 7.45 ± 1.73 | 7.39 ± 1.61 | 7.47 ± 1.59 | 7.31 ± 1.64 | 7.23 ± 1.56 | 7.19 ± 1.6 | 7.31 ± 1.61 | 7.44 ± 1.63 | 7.36 ± 1.7 | 7.2 ± 1.45 | 7.4 ± 1.71 | 7.69 ± 1.7 | 7.48 ± 1.59 | 7.47 ± 1.63 | 7.59 ± 1.65 |
| % Ever smoked | 43.48 | 53.75 | 32.63 | 62.86 | 39.43 | 34.82 | 71.67 | 39.69 | 53.81 | 44.72 | 55.15 | 39.38 | 44.11 | 70.13 | 53.87 |
| % Ever alcohol | 84.62 | 88.59 | 92.34 | 92.02 | 91.2 | 89.49 | 93.06 | 90.68 | 89.97 | 92.57 | 90.79 | 89.61 | 93.74 | 87.77 | 91.82 |
| Comorbidities at NIAD [N, (%)] | |||||||||||||||
| Stroke | 86 (1.32) | 46 (2.57) | 62 (3.65) | 82 (7.03) | < 1 % | 34 (2.23) | 37 (10.28) | < 1 % | 32 (3.34) | 258 (16.82) | 55 (5.45) | 18 (1.19) | 57 (5.33) | 25 (3.56) | 30 (4.38) |
| Myocardial infarction | < 1 % | 370 (20.69) | < 1 % | 99 (8.49) | < 1 % | < 1 % | 63 (17.50) | 76 (6.27) | 517 (54.02) | 30 (1.96) | 61 (6.04) | < 1 % | 201 (18.79) | 33 (4.69) | 162 (23.65) |
| Congestive heart failure | < 1 % | < 1 % | < 1 % | 95 (8.15) | < 1 % | < 1 % | 35 (9.72) | 46 (3.80) | 231 (24.14) | < 1 % | 24 (2.38) | < 1 % | 103 (9.63) | < 1 % | < 1 % |
| Peripheral vascular disease | < 1 % | 54 (3.02) | < 1 % | < 1 % | < 1 % | < 1 % | 108 (30.00) | < 1 % | < 1 % | < 1 % | 230 (22.77) | < 1 % | 15 (1.40) | 7 (1.00) | 21 (3.07) |
| Diabetic retinopathy | 159 (2.44) | < 1 % | 931 (54.83) | 188 (16.12) | 97 (2.48) | < 1 % | 61 (16.94) | < 1 % | 22 (2.30) | 50 (3.26) | 144 (14.26) | 714 (47.25) | 556 (51.96) | 87 (12.38) | 352 (51.39) |
| Hypertension | 310 (4.77) | 19 (1.06) | 1573 (92.64) | 1012 (86.79) | 3398 (86.88) | 1428 (93.82) | 207 (57.50) | 1080 (89.11) | 721 (75.34) | 1363 (88.85) | 700 (69.31) | 29 (1.92) | 945 (88.32) | 27 (3.84) | < 1 % |
| Chronic kidney disease | < 1 % | < 1 % | < 1 % | 434 (37.22) | < 1 % | < 1 % | 57 (15.83) | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 198 (28.17) | < 1 % |
| Osteoporosis | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 96 (26.67) | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % |
| COPD | < 1 % | < 1 % | < 1 % | 500 (42.88) | < 1 % | < 1 % | 158 (43.89) | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 343 (48.79) | 7 (1.02) |
| Chronic liver disease | 81 (1.25) | 38 (2.13) | < 1 % | < 1 % | < 1 % | < 1 % | 75 (20.83) | < 1 % | < 1 % | < 1 % | 411 (40.69) | 36 (2.38) | < 1 % | 15 (2.13) | 10 (1.46) |
| Comorbidities during follow-up [N, (%)] | |||||||||||||||
| Stroke | < 1 % | 47 (2.63) | 34 (2.00) | 43 (3.69) | 42 (1.07) | 35 (2.30) | 10 (2.78) | < 1 % | 39 (4.08) | 84 (5.48) | 19 (1.88) | 18 (1.19) | 32 (2.99) | 14 (1.99) | 22 (3.21) |
| Myocardial infarction | < 1 % | 107 (5.98) | < 1 % | 25 (2.14) | < 1 % | < 1 % | 8 (2.22) | 39 (3.22) | 58 (6.06) | 58 (3.78) | 25 (2.48) | < 1 % | 58 (5.42) | 11 (1.56) | 33 (4.82) |
| Congestive heart failure | < 1 % | 58 (3.24) | < 1 % | 65 (5.57) | < 1 % | < 1 % | 24 (6.67) | 42 (3.47) | 95 (9.93) | 31 (2.02) | 13 (1.29) | < 1 % | 79 (7.38) | 11 (1.56) | 16 (2.34) |
| Peripheral vascular disease | < 1 % | 47 (2.63) | 20 (1.18) | 32 (2.74) | < 1 % | 21 (1.38) | 27 (7.50) | < 1 % | 30 (3.13) | 22 (1.43) | 72 (7.13) | < 1 % | 21 (1.96) | 9 (1.28) | 19 (2.77) |
| Diabetic retinopathy | 700 (10.76) | 263 (14.71) | 767 (45.17) | 256 (21.96) | 457 (11.68) | 224 (14.72) | 72 (20.00) | 171 (14.11) | 116 (12.12) | 192 (12.52) | 169 (16.73) | 797 (52.75) | 514 (48.04) | 130 (18.49) | 333 (48.61) |
| Hypertension | 585 (8.99) | 202 (11.30) | 113 (6.65) | 75 (6.43) | 395 (10.10) | 90 (5.91) | 24 (6.67) | 88 (7.26) | 38 (3.97) | 91 (5.93) | 75 (7.43) | 160 (10.59) | 54 (5.05) | 58 (8.25) | 54 (7.88) |
| Chronic kidney disease | 66 (1.01) | 35 (1.96) | 32 (1.88) | 165 (14.15) | 44 (1.13) | 36 (2.37) | 40 (11.11) | 39 (3.22) | 31 (3.24) | 27 (1.76) | 13 (1.29) | 22 (1.46) | 47 (4.39) | 102 (14.51) | 21 (3.07) |
| Osteoporosis | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 20 (5.56) | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % |
| COPD | < 1 % | 62 (3.47) | 21 (1.24) | 134 (11.49) | 50 (1.28) | 21 (1.38) | 36 (10.00) | 26 (2.15) | 33 (3.45) | 39 (2.54) | 24 (2.38) | < 1 % | 39 (3.64) | 85 (12.09) | 17 (2.48) |
| Chronic liver disease | 108 (1.66) | 45 (2.52) | 37 (2.18) | 23 (1.97) | 48 (1.23) | 24 (1.58) | 27 (7.50) | 27 (2.23) | 16 (1.67) | 20 (1.30) | 140 (13.86) | 43 (2.85) | 29 (2.71) | 18 (2.56) | 30 (4.38) |
| Deaths before 2020 | 97 (1.49) | 67 (3.75) | 30 (1.77) | 88 (7.55) | 78 (1.99) | 51 (3.35) | 85 (23.61) | 55 (4.54) | 68 (7.11) | 55 (3.59) | 238 (23.56) | 31 (2.05) | 60 (5.61) | 36 (5.12) | 28 (4.09) |
Table 8: Patient characteristics in each cluster for the Men < 65 cohort with average values and standard deviation where applicable. Comorbidities are presented as absolute counts at NIAD initiation, along with the number of new comorbidities developed post-NIAD. Proportions, expressed as percentages of the cohort population, are reported in parentheses.

Figure 14: Average cluster-specific probabilities and lab values for Men < 65. Values have been centered by subtracting the average at the time of NIAD initiation to improve readability. Red bars indicate increases, and blue bars indicate decreases relative to the average patient at NIAD. Comorbidity risks are shown as changes in probability (left axis), and lab values as percentage changes relative to the reference value (right axis). Annotated numbers indicate absolute changes in the original units (see Table 1). Error bars represent the standard error of the mean.

Cluster Evolution starting from 1
Cluster Evolution starting from 3

Cluster Evolution starting from 2
Cluster Evolution starting from 4

Cluster Evolution starting from 5
Cluster Evolution starting from 7
Cluster Evolution starting from 3
Cluster 2
Cluster 4
Cluster Evolution starting from 8
Cluster Evolution starting from 5
Cluster 2
Cluster 3
Cluster 5
Cluster Evolution starting from 9
Cluster Evolution starting from 7
Cluster 3
Cluster 7
Cluster 12

Cluster Evolution starting from 10
Cluster Evolution starting from 8
Cluster 3
Cluster 8
Cluster 12

Cluster Evolution starting from 11
Cluster Evolution starting from 9
Cluster 2
Cluster 10

Cluster Evolution starting from 12

Cluster Evolution starting from 13
Cluster 6
Cluster 10
Cluster 2
Cluster 11
Cluster Evolution starting from 12
Cluster Evolution starting from 14
Cluster 3
Cluster 13
Cluster Evolution starting from 14
Cluster 12
Cluster 14
Figure 15: Evolution of patient clusters over time (Men < 65), conditional on the initial cluster assignment (6 months post-NIAD). The number of patients in each cluster is indicated alongside the corresponding bars. For clarity, only the most frequent transitions are shown (see Figure 16 for more details). Cluster 6 is excluded due to the low number of transitions observed from this cluster.

Figure 16: Cumulative Incidence Function (CIF) for the time to first cluster transition in Men < 65, stratified by initial cluster assignment at 6 months post-NIAD. The estimates account for censoring due to loss to follow-up and study termination, computed using the Aalen nonparametric estimator [25].

Figure 17: Transition graph. Red arrows (resp. blue) means an increase (resp. decrease) of the comorbidity risk (Men < 65). Arrow thickness is proportional to the number of observed transitions. Transitions with less than 1% probability are not shown.
F Male 65+
| Cluster | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| # of patients | 2732 | 1515 | 1813 | 838 | 1974 | 1430 | 1125 | 1214 | 1954 | 3028 | 769 | 762 | 1319 |
| Avg. age at NIAD (y) ± SD | 72.61 ± 6.01 | 72.22 ± 5.62 | 73.01 ± 5.74 | 75.48 ± 6.69 | 74.38 ± 6.09 | 74.57 ± 6.37 | 75.52 ± 6.54 | 73.3 ± 6.12 | 74.73 ± 6.57 | 72.0 ± 5.39 | 75.14 ± 6.76 | 73.46 ± 6.24 | 74.14 ± 6.3 |
| Avg. follow-up post-NIAD (y) ± SD | 4.4 ± 3.1 | 5.31 ± 2.86 | 5.08 ± 2.85 | 4.45 ± 2.8 | 4.9 ± 2.9 | 5.15 ± 3.28 | 4.37 ± 2.85 | 5.79 ± 3.08 | 4.04 ± 2.78 | 4.46 ± 3.1 | 4.89 ± 2.81 | 5.35 ± 2.73 | 4.96 ± 2.97 |
| Avg. BMI at NIAD (kg/m) ± SD | 28.68 ± 4.35 | 30.01 ± 4.87 | 29.41 ± 3.84 | 29.9 ± 5.1 | 30.54 ± 5.51 | 29.78 ± 3.97 | 30.13 ± 5.43 | 34.35 ± 6.26 | 29.0 ± 3.88 | 29.71 ± 4.17 | 32.81 ± 5.74 | 33.89 ± 6.31 | 28.94 ± 5.19 |
| Avg. HbA1c at NIAD (%) ± SD | 6.96 ± 1.33 | 7.33 ± 1.41 | 7.16 ± 1.36 | 7.09 ± 1.39 | 6.94 ± 1.33 | 6.95 ± 1.24 | 7.12 ± 1.36 | 6.87 ± 1.3 | 7.11 ± 1.37 | 6.92 ± 1.28 | 7.01 ± 1.36 | 7.21 ± 1.38 | 7.1 ± 1.36 |
| % Ever smoked | 29.61 | 31.22 | 26.86 | 27.92 | 45.54 | 27.48 | 56.44 | 27.68 | 41.91 | 27.87 | 34.72 | 29.27 | 48.6 |
| % Ever alcohol | 89.09 | 90.83 | 94.65 | 91.53 | 93.31 | 88.67 | 90.58 | 90.86 | 90.69 | 90.62 | 91.94 | 93.31 | 91.51 |
| Comorbidities at NIAD [N, (%)] | |||||||||||||
| Stroke | 189 (6.92) | 111 (7.33) | < 1 % | 748 (89.26) | 218 (11.04) | 45 (3.15) | 196 (17.42) | 88 (7.25) | 316 (16.17) | 31 (1.02) | 154 (20.03) | 60 (7.87) | 139 (10.54) |
| Myocardial infarction | 201 (7.36) | 170 (11.22) | < 1 % | < 1 % | < 1 % | < 1 % | 579 (51.47) | < 1 % | 1156 (59.16) | < 1 % | 450 (58.52) | < 1 % | 209 (15.85) |
| Congestive heart failure | 72 (2.64) | 77 (5.08) | 35 (1.93) | 45 (5.37) | 144 (7.29) | 175 (12.24) | 233 (20.71) | 59 (4.86) | 258 (13.20) | < 1 % | 166 (21.59) | 52 (6.82) | 133 (10.08) |
| Peripheral vascular disease | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 478 (42.49) | < 1 % | 731 (37.41) | < 1 % | 295 (38.36) | < 1 % | < 1 % |
| Diabetic retinopathy | 28 (1.02) | 667 (44.03) | 1179 (65.03) | 207 (24.70) | 227 (11.50) | 25 (1.75) | 200 (17.78) | < 1 % | 393 (20.11) | 55 (1.82) | 168 (21.85) | 465 (61.02) | 222 (16.83) |
| Hypertension | 118 (4.32) | 30 (1.98) | 1774 (97.85) | 805 (96.06) | 1911 (96.81) | 1377 (96.29) | 849 (75.47) | 1159 (95.47) | 1504 (76.97) | 2893 (95.54) | 542 (70.48) | 730 (95.80) | 27 (2.05) |
| Chronic kidney disease | 53 (1.94) | 52 (3.43) | < 1 % | < 1 % | 68 (3.44) | < 1 % | 66 (5.87) | 345 (28.42) | < 1 % | < 1 % | 290 (37.71) | 289 (37.93) | 46 (3.49) |
| Osteoporosis | < 1 % | < 1 % | < 1 % | < 1 % | 39 (1.98) | < 1 % | 28 (2.49) | < 1 % | < 1 % | < 1 % | 13 (1.69) | 14 (1.84) | 37 (2.81) |
| COPD | < 1 % | < 1 % | < 1 % | < 1 % | 1063 (53.85) | < 1 % | 609 (54.13) | < 1 % | < 1 % | < 1 % | < 1 % | 29 (3.81) | 669 (50.72) |
| Chronic liver disease | 36 (1.32) | 26 (1.72) | 31 (1.71) | 14 (1.67) | 34 (1.72) | 24 (1.68) | 27 (2.40) | < 1 % | 28 (1.43) | 54 (1.78) | 16 (2.08) | 37 (4.86) | 21 (1.59) |
| Comorbidities during follow-up [N, (%)] | |||||||||||||
| Stroke | 94 (3.44) | 63 (4.16) | 65 (3.59) | 90 (10.74) | 99 (5.02) | 50 (3.50) | 82 (7.29) | 47 (3.87) | 105 (5.37) | 89 (2.94) | 45 (5.85) | 42 (5.51) | 53 (4.02) |
| Myocardial infarction | 47 (1.72) | 38 (2.51) | 22 (1.21) | 10 (1.19) | 42 (2.13) | 22 (1.54) | 67 (5.96) | 18 (1.48) | 91 (4.66) | 40 (1.32) | 41 (5.33) | 26 (3.41) | 23 (1.74) |
| Congestive heart failure | 68 (2.49) | 68 (4.49) | 59 (3.25) | 30 (3.58) | 118 (5.98) | 104 (7.27) | 113 (10.04) | 72 (5.93) | 120 (6.14) | 51 (1.68) | 66 (8.58) | 63 (8.27) | 62 (4.70) |
| Peripheral vascular disease | < 1 % | 22 (1.45) | 19 (1.05) | 19 (2.27) | 51 (2.58) | 15 (1.05) | 115 (10.22) | 13 (1.07) | 150 (7.68) | < 1 % | 52 (6.76) | 12 (1.57) | 25 (1.90) |
| Diabetic retinopathy | 214 (7.83) | 510 (33.66) | 615 (33.92) | 152 (18.14) | 341 (17.27) | 159 (11.12) | 216 (19.20) | 132 (10.87) | 311 (15.92) | 296 (9.78) | 148 (19.25) | 221 (29.00) | 303 (22.97) |
| Hypertension | 245 (8.97) | 140 (9.24) | 32 (1.77) | 15 (1.79) | 41 (2.08) | 21 (1.47) | 47 (4.18) | 33 (2.72) | 54 (2.76) | 88 (2.91) | 19 (2.47) | 21 (2.76) | 98 (7.43) |
| Chronic kidney disease | 84 (3.07) | 62 (4.09) | 47 (2.59) | 26 (3.10) | 89 (4.51) | 46 (3.22) | 49 (4.36) | 166 (13.67) | 49 (2.51) | 71 (2.34) | 120 (15.60) | 110 (14.44) | 70 (5.31) |
| Osteoporosis | < 1 % | < 1 % | < 1 % | 10 (1.19) | < 1 % | < 1 % | 16 (1.42) | < 1 % | < 1 % | < 1 % | < 1 % | 14 (1.84) | < 1 % |
| COPD | 42 (1.54) | 33 (2.18) | 35 (1.93) | 13 (1.55) | 193 (9.78) | 31 (2.17) | 142 (12.62) | 27 (2.22) | 38 (1.94) | 41 (1.35) | 22 (2.86) | 26 (3.41) | 120 (9.10) |
| Chronic liver disease | 28 (1.02) | 30 (1.98) | 20 (1.10) | 13 (1.55) | 26 (1.32) | < 1 % | 17 (1.51) | 22 (1.81) | < 1 % | 31 (1.02) | 21 (2.73) | 18 (2.36) | 17 (1.29) |
| Deaths before 2020 | 344 (12.59) | 205 (13.53) | 200 (11.03) | 195 (23.27) | 472 (23.91) | 254 (17.76) | 384 (34.13) | 222 (18.29) | 424 (21.70) | 315 (10.40) | 219 (28.48) | 163 (21.39) | 309 (23.43) |
Table 9: Patient characteristics in each cluster for the Men 65+ cohort with average values and standard deviation where applicable. Comorbidities are presented as absolute counts at NIAD initiation, along with the number of new comorbidities developed post-NIAD. Proportions, expressed as percentages of the cohort population, are reported in parentheses.

Figure 18: Average cluster-specific probabilities and lab values for Men 65+. Values have been centered by subtracting the average at the time of NIAD initiation to improve readability. Red bars indicate increases, and blue bars indicate decreases relative to the average patient at NIAD. Comorbidity risks are shown as changes in probability (left axis), and lab values as percentage changes relative to the reference value (right axis). Annotated numbers indicate absolute changes in the original units (see Table 1). Error bars represent the standard error of the mean.

Cluster Evolution starting from 1
Cluster Evolution starting from 5

Cluster Evolution starting from 4
Cluster Evolution starting from 7

Cluster Evolution starting from 9

Cluster Evolution starting from 12
Cluster Evolution starting from 12

Cluster Evolution starting from 12

Cluster Evolution starting from 12

Figure 19: Evolution of patient clusters over time (Men 65+), conditional on the initial cluster assignment (6 months post-NIAD). The number of patients in each cluster is indicated alongside the corresponding bars. For clarity, only the most frequent transitions are shown (see Figure 20 for more details). Clusters 2,3,6,8,10,11 are excluded due to the low number of transitions observed from these clusters.

Figure 20: Cumulative Incidence Function (CIF) for the time to first cluster transition in Men 65+, stratified by initial cluster assignment at 6 months post-NIAD. The estimates account for censoring due to loss to follow-up and study termination, computed using the Aalen nonparametric estimator [25].

Figure 21: Transition graph. Red arrows (resp. blue) means an increase (resp. decrease) of the comorbidity risk (Men 65+). Arrow thickness is proportional to the number of observed transitions. Transitions with less than 1% probability are not shown.
G Female 65+
| Cluster | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| # of patients | 2604 | 857 | 1629 | 742 | 1626 | 1276 | 787 | 1258 | 681 | 3702 | 716 | 644 | 452 |
| Avg. age at NIAD (y) ± SD | 72.7 ± 5.8 | 72.98 ± 5.79 | 74.91 ± 6.32 | 74.08 ± 6.18 | 76.72 ± 6.69 | 79.47 ± 7.44 | 76.98 ± 7.06 | 73.32 ± 5.86 | 78.33 ± 7.13 | 73.24 ± 5.72 | 73.69 ± 6.0 | 77.85 ± 7.15 | 74.04 ± 6.35 |
| Avg. follow-up post-NIAD (y) ± SD | 4.7 ± 3.12 | 5.11 ± 2.68 | 5.07 ± 2.71 | 4.35 ± 2.77 | 5.52 ± 3.12 | 3.5 ± 2.66 | 3.79 ± 2.64 | 6.0 ± 3.23 | 4.04 ± 2.31 | 4.82 ± 3.24 | 5.7 ± 2.68 | 4.24 ± 2.78 | 4.91 ± 2.73 |
| Avg. BMI at NIAD (kg/m) ± SD | 30.24 ± 6.15 | 29.99 ± 5.92 | 29.84 ± 4.83 | 32.63 ± 6.74 | 28.96 ± 5.31 | 27.99 ± 4.72 | 29.53 ± 6.46 | 36.76 ± 7.37 | 30.7 ± 6.34 | 30.74 ± 4.8 | 36.67 ± 7.09 | 34.36 ± 7.83 | 31.65 ± 6.33 |
| Avg. HbA1c at NIAD (%) ± SD | 6.96 ± 1.27 | 7.24 ± 1.32 | 7.09 ± 1.29 | 7.08 ± 1.39 | 6.83 ± 1.3 | 7.08 ± 1.35 | 7.15 ± 1.42 | 6.98 ± 1.26 | 7.37 ± 1.49 | 6.9 ± 1.25 | 7.05 ± 1.18 | 7.09 ± 1.41 | 7.32 ± 1.37 |
| % Ever smoked | 30.72 | 32.79 | 24.86 | 64.56 | 18.02 | 31.03 | 43.96 | 24.24 | 37.0 | 21.47 | 25.56 | 33.7 | 23.67 |
| % Ever alcohol | 79.26 | 86.23 | 86.68 | 83.42 | 83.95 | 77.59 | 74.84 | 80.21 | 85.32 | 81.5 | 84.36 | 77.02 | 84.07 |
| Comorbidities at NIAD [N, (%)] | |||||||||||||
| Stroke | 137 (5.26) | 63 (7.35) | 141 (8.66) | 80 (10.78) | 158 (9.72) | 263 (20.61) | 109 (13.85) | 105 (8.35) | 138 (20.26) | 197 (5.32) | 73 (10.20) | 123 (19.10) | 30 (6.64) |
| Myocardial infarction | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 322 (25.24) | 259 (32.91) | < 1 % | 189 (27.75) | < 1 % | < 1 % | 162 (25.16) | < 1 % |
| Congestive heart failure | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 299 (23.43) | 179 (22.74) | < 1 % | 214 (31.42) | < 1 % | < 1 % | 230 (35.71) | < 1 % |
| Peripheral vascular disease | < 1 % | < 1 % | < 1 % | < 1 % | < 1 % | 203 (15.91) | 120 (15.25) | < 1 % | 161 (23.64) | < 1 % | < 1 % | 132 (20.50) | < 1 % |
| Diabetic retinopathy | 61 (2.34) | 485 (56.59) | 1014 (62.25) | 33 (4.45) | 24 (1.48) | 41 (3.21) | 96 (12.20) | < 1 % | 436 (64.02) | 73 (1.97) | 465 (64.94) | 23 (3.57) | 252 (55.75) |
| Hypertension | 110 (4.22) | 9 (1.05) | 1599 (98.16) | 704 (94.88) | 1582 (97.29) | 1226 (96.08) | 31 (3.94) | 1233 (98.01) | 663 (97.36) | 3587 (96.89) | 708 (98.88) | 626 (97.20) | 439 (97.12) |
| Chronic kidney disease | 113 (4.34) | 44 (5.13) | < 1 % | 42 (5.66) | 26 (1.60) | < 1 % | 55 (6.99) | 326 (25.91) | 56 (8.22) | < 1 % | 173 (24.16) | 204 (31.68) | 18 (3.98) |
| Osteoporosis | 177 (6.80) | 60 (7.00) | 65 (3.99) | 78 (10.51) | 483 (29.70) | 80 (6.27) | 101 (12.83) | < 1 % | 88 (12.92) | < 1 % | 53 (7.40) | 76 (11.80) | 22 (4.87) |
| COPD | 246 (9.45) | 95 (11.09) | 91 (5.59) | 647 (87.20) | < 1 % | 132 (10.34) | 195 (24.78) | < 1 % | 124 (18.21) | < 1 % | 53 (7.40) | 118 (18.32) | 31 (6.86) |
| Chronic liver disease | 57 (2.19) | 32 (3.73) | < 1 % | 18 (2.43) | 22 (1.35) | 16 (1.25) | 15 (1.91) | 19 (1.51) | 12 (1.76) | 46 (1.24) | < 1 % | 13 (2.02) | 157 (34.73) |
| Comorbidities during follow-up [N, (%)] | |||||||||||||
| Stroke | 98 (3.76) | 22 (2.57) | 75 (4.60) | 27 (3.64) | 77 (4.74) | 68 (5.33) | 50 (6.35) | 57 (4.53) | 37 (5.43) | 134 (3.62) | 44 (6.15) | 45 (6.99) | 25 (5.53) |
| Myocardial infarction | < 1 % | < 1 % | 19 (1.17) | 9 (1.21) | < 1 % | 43 (3.37) | 14 (1.78) | 26 (2.07) | 36 (5.29) | 39 (1.05) | 8 (1.12) | 30 (4.66) | 5 (1.11) |
| Congestive heart failure | 45 (1.73) | 22 (2.57) | 33 (2.03) | 33 (4.45) | 40 (2.46) | 86 (6.74) | 58 (7.37) | 66 (5.25) | 58 (8.52) | 73 (1.97) | 38 (5.31) | 76 (11.80) | 13 (2.88) |
| Peripheral vascular disease | < 1 % | < 1 % | < 1 % | 13 (1.75) | 21 (1.29) | 42 (3.29) | 29 (3.68) | 16 (1.27) | 34 (4.99) | < 1 % | < 1 % | 28 (4.35) | 6 (1.33) |
| Diabetic retinopathy | 296 (11.37) | 372 (43.41) | 615 (37.75) | 109 (14.69) | 215 (13.22) | 82 (6.43) | 107 (13.60) | 169 (13.43) | 245 (35.98) | 415 (11.21) | 251 (35.06) | 57 (8.85) | 153 (33.85) |
| Hypertension | 324 (12.44) | 86 (10.04) | 27 (1.66) | 21 (2.83) | 32 (1.97) | 13 (1.02) | 56 (7.12) | 22 (1.75) | 9 (1.32) | 76 (2.05) | < 1 % | < 1 % | 12 (2.65) |
| Chronic kidney disease | 64 (2.46) | 34 (3.97) | 30 (1.84) | 26 (3.50) | 41 (2.52) | 17 (1.33) | 33 (4.19) | 116 (9.22) | 25 (3.67) | 61 (1.65) | 65 (9.08) | 89 (13.82) | 9 (1.99) |
| Osteoporosis | 78 (3.00) | 26 (3.03) | 56 (3.44) | 22 (2.96) | 147 (9.04) | 24 (1.88) | 22 (2.80) | 30 (2.38) | 24 (3.52) | 43 (1.16) | 23 (3.21) | 21 (3.26) | 12 (2.65) |
| COPD | 78 (3.00) | 22 (2.57) | 38 (2.33) | 93 (12.53) | 34 (2.09) | 37 (2.90) | 36 (4.57) | 33 (2.62) | 31 (4.55) | 54 (1.46) | 20 (2.79) | 40 (6.21) | 11 (2.43) |
| Chronic liver disease | 40 (1.54) | 9 (1.05) | < 1 % | 10 (1.35) | 23 (1.41) | < 1 % | < 1 % | 14 (1.11) | 10 (1.47) | 37 (1.00) | < 1 % | < 1 % | 43 (9.51) |
| Deaths before 2020 | 191 (7.33) | 86 (10.04) | 142 (8.72) | 165 (22.24) | 203 (12.48) | 603 (47.26) | 352 (44.73) | 134 (10.65) | 268 (39.35) | 211 (5.70) | 87 (12.15) | 279 (43.32) | 34 (7.52) |
Table 10: Patient characteristics in each cluster for the Women 65+ cohort with average values and standard deviation where applicable. Comorbidities are presented as absolute counts at NIAD initiation, along with the number of new comorbidities developed post-NIAD. Proportions, expressed as percentages of the cohort population, are reported in parentheses.

Figure 22: Average cluster-specific probabilities and lab values for Women 65+. Values have been centered by subtracting the average at the time of NIAD initiation to improve readability. Red bars indicate increases, and blue bars indicate decreases relative to the average patient at NIAD. Comorbidity risks are shown as changes in probability (left axis), and lab values as percentage changes relative to the reference value (right axis). Annotated numbers indicate absolute changes in the original units (see Table 1). Error bars represent the standard error of the mean.

Cluster Evolution starting from 2
Cluster Evolution starting from 4

Cluster Evolution starting from 3
Cluster Evolution starting from 5

Cluster Evolution starting from 6

Cluster Evolution starting from 7
Cluster Evolution starting from 5
Cluster Evolution starting from 9
Cluster Evolution starting from 6
Cluster Evolution starting from 10
Cluster Evolution starting from 11
Cluster Evolution starting from 11
Cluster Evolution starting from 12
Cluster Evolution starting from 10
Cluster Evolution starting from 12
Figure 23: Evolution of patient clusters over time (Women 65+), conditional on the initial cluster assignment (6 months post-NIAD). The number of patients in each cluster is indicated alongside the corresponding bars. For clarity, only the most frequent transitions are shown (see Figure 24 for more details). Clusters 1,8 are excluded due to the low number of transitions observed from these clusters.

Figure 24: Cumulative Incidence Function (CIF) for the time to first cluster transition in Women 65+, stratified by initial cluster assignment at 6 months post-NIAD. The estimates account for censoring due to loss to follow-up and study termination, computed using the Aalen nonparametric estimator [25].

Figure 25: Transition graph. Red arrows (resp. blue) means an increase (resp. decrease) of the comorbidity risk (Women 65+). Arrow thickness is proportional to the number of observed transitions. Transitions with less than 1% probability are not shown.