Abstract
Introduction
Longitudinal studies with time-to-event outcomes in social research often use a form of event history analysis (EHA) to analyse the influence of (time-varying) covariates on one or several time-to-event outcomes. Applications in social and life course research include a range of event types like divorce (Rosenfeld and Roesler 2019), birth (Baschieri and Hinde 2007), death (Moore and Hayward 1990), job change (Carroll and Mayer 1986; Becker and Blossfeld 2017), interest group survival (Nownes and Lipinski 2005), migrations (Baydar et al. 1990; Henry et al. 2004), and friendship formation and dissolution (Dean et al. 2017).
Both the popular Cox proportional hazards model for the analysis of time-to-event outcomes as well as other types of event history models used to model the effect of time-varying covariates on an event typically assume the relation between the covariate and time-to-event process to be exogenous, meaning that the covariate process does not depend on the survival process (Rizopoulos 2012:44). In other words, the path of an exogenous time-varying covariate up to a specific time is not allowed to be influenced by the occurrence of an event at that time and an anticipated event is thus assumed not to affect the covariate values. Covariates for which this assumption is not met are referred to as endogenous covariates. Failing to appropriately deal with endogenous covariates typically leads to attenuation bias (Ibrahim et al. 2010). Within a larger econometric literature such bias is more commonly referred to as simultaneity bias, that is bias induced by the fact that the time-to-event outcome and time-varying covariate are jointly determined. As an illustration we may consider the effect of anticipated retirement age on late career employment status. Imagine two individuals, A and B, both newly unemployed at age 60. Individual A has paid into an early retirement scheme and knows he/she can retire at age 62 whereas individual B has not paid into such a scheme and can only retire at age 65. One can imagine that their motivation to search for and take up new full time employment differs and therefore the future path of their employment status will most likely differ as well. The likelihood of these individuals taking up new full time employment thus depends on their anticipated retirement age, that is the probability of the event, retirement, occurring at a specific time point. Simply including employment status as a covariate in a Cox model will lead to an underestimation of the effect of employment status on the retirement hazard. A way to deal with covariate endogeneity is to model the time-varying covariate and time-to-event outcome simultaneously as two outcome variables in a joint model for longitudinal and time-to-event data (Lillard and Waite 1993; Faucett and Thomas 1996; Wulfsohn and Tsiatis 1997). Note that in this specific case, with one time-to-event and one categorical longitudinal outcome, multistate models (Cook and Lawless 2018) could also be a viable option for analysis. Apart from covariate endogeneity, joint models also allow for incomplete time-varying covariates as well as measurement error in covariates, two additional problems that cannot be dealt with in the standard Cox model. Joint models have over the past decades received considerable attention in biostatistical research for their ability to deal with measurement error and incomplete longitudinal data as well as their ability to model and quantify endogenous relations between longitudinal covariates and time-to-event outcomes, several longitudinal outcomes and multiple time-to-event outcomes. Since its introduction a multitude of extensions to the standard joint model have been proposed making it a flexible framework for modeling time-to-event and longitudinal variables (see e.g. Hickey et al. (2018) for an extensive overview of available methods for joint models with two or more time-to-event variables and Hickey et al. (2016) for a review of methods for joint models with multiple longitudinal variables).
Whereas in biostatistical and medical research the joint model is well established, in social research joint models have only occasionally been used even though they address an important problem concerning endogenous covariates. In our literature search, we have been able to identify a mere total of six studies in social research that use joint models. In Steele et al. (2013) the relationship between employment transitions and mental health is investigated using a joint model for two longitudinal outcomes. Joint models for a longitudinal and time-to-event outcome are used in Lutz (2014) to explore the relation between occupational activity and the timing of first births and Karimi et al. (2018) for the relation between socio-professional trajectories and cause-specific mortality. Joint models for multiple time-to-event outcomes are used in Lillard and Waite (1993) for the relation between marital conception and marital disruption, Ermisch and Steele (2016) for the relation between fertility expectations and residential mobility and Li et al. (2020) for the relation between employment, fertility and retirement. The majority of social research involving time-to-event outcomes however employs more standard methods that do not allow for covariate endogeneity.
The purpose of the present paper is to extend the social science modeling toolkit beyond the standard event history model to include joint models for longitudinal and time-to-event outcomes. We achieve this goal by first giving a short introduction to joint models for longitudinal and time-to-event outcomes after which we will introduce a novel Bayesian joint model for longitudinal and time-to-event data. This model specifies the relation between the longitudinal and time-to-event outcomes differently from most other (Bayesian) joint models in the literature and can be flexibly extended to include multiple longitudinal and survival outcomes. We will argue that the specific association structure of this joint model may be more suitable in social research, where the longitudinal outcome is of interest in itself and the focus is not solely on the time-to-event outcome. Subsequently, we show the use of the Bayesian joint model, the interpretation of its results and its advantages over a standard event history analysis. We will do so by analysing Danish labour market attachment data in which we jointly model employment and retirement status and comparing the results of this model to those of a standard event history model. We will conclude the paper with a discussion of the advantages and limitations of the joint model as well as some suggestions for further research.
Joint models for Longitudinal and Time-to-Event Outcomes
A joint model for longitudinal and time-to-event outcomes combines at least two submodels, one for the longitudinal and one for the time-to-event outcome. These submodels are referred to as the longitudinal submodel and the survival submodel. The two submodels are linked by means of shared individual-level random effects that can be incorporated in several ways.
The most common approach to joint modeling in the literature is the shared parameter joint model using a current value association structure. In such a model for individuals
Several extensions to this joint model have been proposed. The most common method for incorporating multiple longitudinal outcomes is the specification of a correlated random effects structure (Hickey et al. 2016), other methods have been proposed in Cooper et al. (2007) and Lambert and Vandenhende (2002). In Faucett et al. (1998) and Li et al. (2010) the longitudinal submodel is extended to handle binary or count outcomes. The time-to-event submodel has also been extended in several ways, for example to allow for cause-specific events (Williamson et al. 2008; Huang et al. 2011) or recurring events (Król et al. 2017; Li et al. 2020). The main differences between joint models in the literature however lies in the way they quantify the association between the longitudinal and time-to-event outcome. Apart from the current value association outlined above, lagged value, current and lagged slope, cumulative effects, lagged cumulative effects, weighted cumulative effects, shared random effects, correlated random effects and shared fixed effects associations as well as associations involving interactions with observed data and between longitudinal outcomes are used in the literature (see Table 1 for an overview of some of these association structures). For a more extensive overview of these association structures we refer to Hickey et al. (2016); Hickey et al. (2018) and Brilleman (2018).
Some Association Structures for Joint Models.
The Bayesian model we introduce in the next section makes use of a correlated random effects association structure where
A Bayesian Correlated Random Effects Joint Model
In this section, we introduce a Bayesian correlated random effects joint model for a categorical longitudinal outcome and one time-to-event outcome. Our choice for a correlated random effects association structure is motivated by its flexibility as well as its better fit to social data types. As exemplified by Elashoff et al. (2008); Huang et al. (2011) and Li et al. (2020) a joint model with a correlated random effects association structure can easily be extended to a competing risk or recurrent events setting. Moreover, by fitting our model using the Stan framework and making code available (see the Estimation section below for more details) researchers wishing to use our model can adapt it to their setting, i.e. including additional outcomes, different prior distributions or models for the longitudinal and time-to-event outcomes, without having to worry about deriving conditional distributions for a Gibbs sampler or having to implement their own Metropolis Hastings algorithms. Finally, the fact that the current value association is the preferred way to implement a joint model in the biostatistical literature, is partly explained by medical research's main interest in the time-to-event outcome, and controlling for a possible influence of exogenous longitudinal variables influencing the time-to-event outcome. In social research however, the longitudinal outcome may be of interest in itself as well. A correlated random effects association structure may in that case be more appropriate, since it does not model a directional effect from the longitudinal outcome onto the time-to-event outcome. In fact, half of the studies in social research employing joint models named in the introduction use a correlated random effects structure.
The methodological novelty of our model is due to the fact that we are to our knowledge the first to use a Bayesian approach to fit a joint model that employs a hierarchical multinomial model for the longitudinal outcome. Such a multinomial structure is useful in social data, where it is often of interest to investigate and compare distinct groups of individuals. This is also exemplified by the six studies employing joint models we named in the introduction. Three of these studies employ a joint model that contains a multinomial longitudinal outcome.
The probability that we observe state
For the time-to-event submodel we use a proportional hazards model with piece-wise constant baseline hazard. In practice, this model can be fit using a hierarchical Poisson regression model for the event indicators
The event history and longitudinal submodels are linked using a joint variance-covariance matrix for the random effects. The random intercepts
Estimation
The Bayesian joint model is estimated using a Hamiltonian Monte Carlo (HMC) sampler (Neal 2011; Betancourt and Girolami 2015) specified in the Stan language (Carpenter et al. 2017) in R (Stan Development Team 2019) (code is included in the Appendix). We specify independent uninformative
Analysis of the Labour Market Attachment Data
In this section we introduce the labour market attachment data and analyse it using our Bayesian joint model. The research question of interest is how a reform in early retirement pension (ERP) affects occupational life-trajectories, especially regarding the relation between employment status and retirement timing.
We will interpret the results from the joint model model and compare these to results from a standard event history model. The standard event history model is equivalent to the time-to-event submodel of the joint model specified in (4). The fit of the standard event history model and the joint model will be evaluated on the complete labour market attachment data by comparing the predicted survival curves of both models to the proportions of retired individuals in the complete data.
Labour market Attachment Data
In Denmark there are three main state-funded retirement schemes that pay monthly benefits to those eligible: old age pension (OAP), early retirement pension and disability pension (DP). Whereas old age pension is available to those over 65, employees that meet certain conditions 1 can opt to make use of the early retirement pension. In 2006 the Danish government announced to gradually alter the age at which the early retirement pension would be available. The reform means that for individuals born in 1953 or earlier, the early retirement age lies at 60 whereas for individuals born in 1954 or later this age is gradually increased from 60.5 for individuals born between 01-01-1954 and 01-07-1954 to computed in relation to life expectancy for individuals born in 1963 and later.
The labour market attachment data contains individual data on monthly labour market status as well as sex and education level for three cohorts, two unaffected (born in 1953 and 1950) and one affected (born in 1954) by the ERP reform, obtained from the Danish population registers. We follow the individuals from these cohorts from the month they turn 58 (in 2008, 2011 and 2012 respectively) up to the month they turn 63 (in 2013, 2016 and 2017 respectively) to show the effect of the reform on the occupational life-trajectories over time. This leads to a dataset with 212,655 individuals (71,459, 71,245 and 69,951 in the 1950, 1953 and 1954 cohort respectively) measured over 60 months. We will refer to this data as the labour market attachment data. Labour market status is divided into four categories: ‘full-time employed’, ‘part-time employed’ and ‘outside the labour market’ refer to the employment status whereas ‘receiving (any type of) pension’ represents the retirement status (see the Appendix for further details on how these categories were created). Figure 1 shows the full labour market attachement data (including deceased individuals). This means that we can follow the transition of Danish individuals from being employed to retirement, and construct what we call occupational life-trajectories. To reduce computation time of the HMC sampler, we take a stratified (on sex and education level) sample from the larger labour market attachment data leading to subsamples of 610, 609 and 596 individuals from the 1950, 1953 and 1954 cohort respectively. On a Windows server with an Intel Xeon CPU E5-2660 v3 processor with 768 GB RAM the analyses took approximately 4.5 h to finish.

Attachment to the labour market over time for three cohorts. The y-axis shows the proportion of the population with a particular attachment (‘fulltime employment’, ‘parttime employment’, ‘outside the labour market’ or ‘receiving pension’). In addition to labour market attachment the proportion of individuals that have died is also shown.
In pension reforms such as the reform in ERP one of the main goals is to increase the employment rate of older individuals in order to alleviate the decline of the working-age population and take into account increasing life expectancy. Increasing the employment rate in this way will have a positive fiscal effect by extending pension contribution periods and reducing the number of individuals receiving pension simultaneously. However, increasing the pension age may have a negative impact if older individuals are not able to work longer and instead end up receiving unemployment benefits. The research question of interest with regard to the labour market attachment data is therefore how the reform in ERP affects occupational life-trajectories, especially regarding the relation between employment status and retirement timing. Additionally, we investigate the effect of education level and gender on the occupational life-trajectories.
Joint Model Results
With regard to the labour market attachment data we are interested in the effect of a policy change in ERP on the occupational life-trajectories. To investigate this effect we split up the attachment in two distinct variables, employment status (longitudinal outcome) and retirement status (time-to-event outcome) that we included as outcome variables in three separate Bayesian joint models, each fit to a subset of one of the three different cohorts of the Danish population. In all models sex (male = 1) and education level (post-secondary or tertiary education = 1) are used as binary covariates. The vectors
The joint model allows us to investigate the effect of the policy change in ERP in several ways. Firstly, we can investigate differences between the three cohorts in the effect of sex and education level on retirement timing. Table 2 shows posterior summaries of the hazard ratios of the exogenous covariates in the time-to-event submodel for the three cohorts. We see that females are about 1.5 times more likely to retire than males in the 1950 and 1953 cohort. In the 1954 cohort however, females are estimated to retire 1.9 times more likely than males. Furthermore, individuals with a post-secondary or tertiary education are 0.64 times as likely to retire as individuals with only primary or secondary education in the 1954 cohort whereas in the other two cohorts the likelihood to retire is not affected by education level.
Posterior Mean and 95% Credible Intervals (CI) of the Hazard Ratios, exp(η), of the Exogenous Covariates (Sex and Education Level) in the Time-to-Event Submodel of the Joint Model for the Three Cohorts. The First Line (Sex) Represents Females vs. Males and the Second Line (Education) Represents Post-Secondary and Tertiary vs. Primary and Secondary Education.
Secondly, we can investigate differences between the three cohorts with regard to the probability of having a certain employment status and the effects of sex and education level on this status. Table 3 shows posterior summaries for the log odds of being employed (fulltime or parttime) versus being outside the labour market. In all three cohorts the odds of being fulltime employed vs. outside the labour market is lower for females than for males. The odds of being parttime employed vs. outside the labour market are higher for females than for males in the 1953 cohort. The odds of being fulltime or parttime employed vs. being outside the labour market are higher for individuals with a high education except for parttime employed individuals in the 1950 cohort. Table 4 shows the probability of having a certain employment state. The probability of being fulltime employed increases over time for all groups except males with a high education level. Whereas the probability of fulltime employment increases from the 1950 to the 1954 cohort, the probability of parttime employment decreases for all groups except males with a higher education (see rows 5 to 8 in Table 4). Note that the increases/decreases in time are not linear for all sex and education subgroups e.g. for females with a high education level the probability of parttime employment increases from the 1950 to 1953 cohort and decreases again from the 1953 to 1954 cohort.
Posterior Mean and 95% Credible Intervals (CI) of the Intercept
Posterior Mean and 95% Credible Intervals (CI) of the Probabilities of Having a Certain Employment status Conditional on Sex (Male/Female) and Education Level (low/high) in the Joint Model for the Three Cohorts.
Finally, the joint model allows us to explore the relation between employment status and retirement timing for the three cohorts. The positive correlation
Posterior Mean and 95% Credible Intervals (CI) of the Random Effect Correlations and Standard Deviations in the Joint Model for the Three Cohorts. The Parameter
Standard Event History Results
To investigate the effect of sex and education level on retirement timing as well as the association between labour market status on retirement timing in the standard event history model we look at the hazard ratios in Table 6. The hazard ratio for sex only indicates an effect in the 1953 (marginal) and 1954 cohort and the hazard ratio for education level indicates a marginal effect in the 1954 cohort. Furthermore, the hazard ratios for the employment status indicate that the pension hazard is lower for individuals that are fulltime or parttime employed in all three cohorts. We cannot investigate differences between the three cohorts with regard to the probability of having a certain employment status since we use employment status as an exogenous predictor instead of as an endogenous outcome variable in the standard even history model.
Posterior Mean and 95% Credible Intervals (CI) of the Hazard Ratios, exp(η), of the Exogenous Covariates (Sex, Education Level and Employment status (Fulltime and Parttime Employment)) in the ‘Standard’ Event History Model for the Three Cohorts.
Model comparison
The results from the standard event history model are slightly different from those of the joint model. The joint model seems to have slightly more power to pick up the effects of sex and education on retirement timing (see the confidence intervals of the hazard ratios in Tables 2 and 6). Second, over time, from the 1950 to the 1954 cohort, the hazard ratios of fulltime and parttime employment in the standard model increase meaning that employed individuals have a higher pension hazard in 1954 than in 1950. This conclusion is opposite to that of the joint model, in which the negative correlations between frailty and random intercept either increase or stay at the same level, indicating the same or a stronger negative relation between employment and retirement. This suggests that not taking the longitudinal data into account can lead to different conclusions. Overall however, the direction of the hazard ratios (and correlation coefficients) of sex, education and employment status, with females, individuals with a shorter education and unemployed individuals being more likely to retire is the same in both the standard and joint model.
Finally, to evaluate the fit of the models we compute Brier scores (BS) for both the joint model and standard event history model. The Brier score can be used to evaluate the predictive accuracy of a survival function at each individual timepoint. It ranges from zero to one, where a zero value represents perfect fit. In a survival setting the Brier score is computed as:

Brier scores for the joint model and standard event history model (lower values are better). The solid lines are the Brier scores computed using the estimated individual posterior mean survival scores. The upper and lower bounds of the shaded region are the Brier scores for the joint and standard event history model computed using the upper and lower bounds of the 95% credible interval of the individual survival scores.
In order to compare the standard event history model to the joint model in more detail we conduct a small simulation study in the next section.
Simulation study
In order to show the endogeneity bias when fitting standard event history models as well as the effects of censoring on the model estimates. Table 7 shows an overview of the parameter values and sample sizes for the seven designs that were compared in the simulation. In each design, 100 datasets were simulated using a correlated random effects joint model in which the survival outcome is a hierarchical poisson log-linear model with random walk baseline and a hierarchical logistic model is used for the longitudinal outcome. We use the same binomial covariates with success probabilities of 0.47 and 0.3 respectively for both outcomes. Code for the simulation study can be found in the Online Supplement.
Simulation Designs.
Table 8 shows the bias and standard deviation of the posterior means of the estimates. The bias is computed as the average deviation of the posterior mean estimate from the real value. Positive and negative values indicate over- and underestimation, respectively. Note that for each design we fit three models: a joint model, a standard event history model, and a standard event history model that includes the binary longitudinal outcome as a time-varying covariate. From Table 8 we conclude that there is a clear bias in the etimates of the standard event history models in all settings. The joint model has least bias as expected. Furthermore, the bias decreases with increasing sample size. Censoring increases bias in
Bias and Standard Deviation of the Estimated Posterior Means.
Discussion
In this paper we have expanded the social science modelling toolkit by introducing a Bayesian joint model for longitudinal and time-to-event data and illustrating the advantages of this model over standard event history analysis by analyzing the labour market attachment data.
As expected, the comparison between the joint model and a standard event history analysis shows that the joint model better fits the labour market attachment data. Additionally, there are some slight differences regarding the effect of employment on the pension hazard. Even though the application of the joint model in the labour market data does not seem to lead to very strong differences in conclusions, this may not be the case for all data. As argued in the introduction, the main reason to prefer the joint model over standard methods, is the fact that it leads to less statistical concerns (about bias) in case of endogenous time-varying covariates than standard event history models. A secondary reason to prefer the joint model, concerns the fact that we are able to include predictors of the time-varying covariate into the model. This is especially advantageous in social research, where the interest may often not solely lie with the time-to-event outcome but where there may be an interest in the time-varying covariate in itself as well.
In some recent studies on retirement timing instead of using time-to-event analyses, regression discontinuity models are used, e.g. in Geyer and Welteke (2019) and Nielsen (2019). In such models however the focus lies on variables that measure retirement at/before a specific age, in which case censoring is not problematic in the sense that this is an observed measure for all individuals. Using such a model in our case may cause problems due to censoring, e.g. the estimated pension hazards may be biased. Also, as mentioned in the introduction, multistate models may be a viable alternative to the joint model in case of the labour market data used in this paper. However, this is only true because the labour market data contains a time-to-event outcome in combination with a categorical longitudinal outcome. If we decide to extend the model with an additional continuous longitudinal outcome, say montly income, joint models can incorporate such outcomes without having to categorize them as multistate models would.
Although the model we introduce in this paper has a major advantage over standard EHA when it comes to the inclusion of endogenous covariates it also comes at a price. Firstly, the computation speed of the joint model. Even though the number of individuals in the subsample of the data we analysed is not very large and we only need to estimate two random effects and one frailty, the computation speed is quite slow. This is partly due to the long observation period, the fact that we use an iterative Bayesian method to estimate the model and the fact that estimation for multinomial distributions has not been optimized in Stan. There are, however, several possibilities to increase the computation speed of the model. Firstly, instead of using iterative Bayesian methods such as HMC sampling we may instead resort to approximate Bayesian methods, e.g. we could use the variational Bayesian methods for approximating the posterior instead of sampling from it that are implemented in Stan (Kucukelbir et al. 2015). Secondly, we can resort to methods for parallel Bayesian computation, e.g. using Consensus Monte Carlo (Neiswanger et al. 2014) or Wasserstein Posterior (Srivastava et al. 2018) methods, for realizing a speed up in computation time. Lastly, we may reparameterize the model or use different methods for specifying the submodels that lead to faster computations (see Bradley et al. (2018) for an example).
Another caveat concerns the fact that although the random effect in the longitudinal submodel describes the employment trajectory of each individual, by modeling the probability of being fulltime-employed, parttime employed or outside of the labour market over the entire trajectory, this summary cannot compete with the more detailed typification that could have been obtained through so-called ‘holistic’ approaches, e.g. sequence analysis or (latent) growth models (Billari and Piccarreta 2005; Piccarreta and Studer 2019). Sequence analysis methods would for example be able to include both the duration and pattern of different employment trajectories as factors influencing different types of employment trajectories. The addition of lagged covariates to the joint model may allow us to bring the description of the employment trajectory of an individual to a level more close to that of sequence analysis methods. Note however that in sequence analysis it is much more complicated to assess the effect of additional (exogenous) covariates.
The joint model introduced in this paper only considers one time-to-event outcome and one longitudinal outcome. We have for example not included death as a competing risks outcome. This can, however, be dealt with in a relatively simple way, as the joint model is flexible and it is straightforward to add additional longitudinal and/or time-to-event outcomes due to its implementation in Stan. To include additional longitudinal outcomes we simply add submodels for additional longitudinal outcomes and include the random effects from these submodels to the variance-covariance matrix. The complexity of adding time-to-event outcomes depends on the association structure we assume. If we assume simultaneous hazards this issue can be solved in the same way as for adding additional longitudinal outcomes. If we assume competing risks we can add submodels for the additional time-to-event outcomes as well but in that case we need to take care when interpreting the parameter estimates (Andersen et al. 2012). Note that the joint model presented in this paper allows for censoring, e.g. due to emigration. Treating death as censoring leads to a model in which the event (early retirement) is allowed to take place sometime after death. Despite the fact that such a potential outcome space after death may be of interest in some applications, the results from such models are difficult to interpret as they reflect a situation that is impossible in the real world.
In conclusion, we have both introduced and shown the use of a Bayesian joint model for longitudinal and time-to-event data. The joint model has clear advantages over a standard survival model. It decreases bias in estimation, it allows us to explore the relation between exogenous covariates and the time-to-event as well as the longitudinal outcome and it allows for flexible extensions in terms of including further longitudinal and time-to-event variables in the same model.
