If I have a biomarker time-dependent variable sampled as a whole time serie, instead of few repeated measurements, and I want to fit a joint model to predict time-to-event as a function of the time-dependent biomarker, does it make sense to add a AR(1) covariate (i.e., the response variable itself lagged back of a period) in the longitudinal mixed submodel, as a fixed or random effect? Would this bias the joint model? Would its predictions be reliable? Would it cause data leakage or other statistical issues, being it an endogenous covariate?

What about adding an estimation of the stochastic trend and seasonality of the time serie as fixed effects in the mixed model?

Thank you very much @EdM for your response! I posted a longer question yesterday, which contained more details, but I thought it would be too long and messy for anyone to read it. Also, you would notice that the covariate isn't in fact a biomarker, in my case, but rather an endogenous variable from a point process.

To specifically answer your questions:

  • The event (withdrawal of a student from the course) can occur either never or once
  • Is not clear to me what is meant with "time reference"; I am still self-learning the topic. If it refers to the time period in which data are collected, and what is the horizon of interest for my predictions, I can say that I am interested in dynamic predictions of the time-to-event during a span of 240 days. Say the first 30 days are passed since the start of the online course, I would like to get predictions for the remaining 210 days. Say another 30 days pass, I would like to update my predictions for the remaining 180 days. And so on.
  • As for the survival submodel, I was thinking of using the Cox Proportional Hazard model, combined with the KM-curve for the estimation of the baseline hazard

There are few particular traits in my case that may be worth noting:

  • There are no censored observations. No one is "lost at follow up", data about each individual (student) are recorded from the start of the course until they either do the final exam or withdraw from the course (withdrawal is the event of interest!)
  • The proportion of individuals who experience the event is a minority (about 25%)
  • The students are observed contemporarily during the time span of the online course: time=0 is the start of the course, so it denotes the same calendar day for student j as for student i.
  • As said, the repeated measures consist of a daily time serie for each student, tracking the total clicks he made each day. There are no missing values, the e-learning website recorded all of their activity during their study time.

I don't know if I should remove the other question I asked and leave just this one, or modify them in any way to better stick to rules of the forum. Please, let me know if anything isn't clear, and thank you again for your kindness!

in practice my model is: mixed_model(fixed = y ~ level + y.lag1, random = ~ time | id_student, data = dts7, family = zi.negative.binomial, zi_fixed = ~0 + level + seasonality + y.lag1 , zi_random = ~ time | id_student)

  • $\begingroup$ Welcome to Cross Validated! Please edit the question to say a bit more about the nature of your data. In particular, can the event occur more than once for an individual? What is the time reference for the time-to-event? Also, what is the general form of the survival model: proportional hazards, accelerated failure time,...? The answer might depend on those details. $\endgroup$
    – EdM
    Sep 5, 2023 at 11:21

1 Answer 1


The random effects already account for the serial correlation you have in the repeated longitudinal measurements. In particular, if you include nonlinear time trends in the random part of the mixed model, you allow for more complex correlation structures. Considering time-series types of serial correlation structures will make more sense if you have many longitudinal measurements per individual.

  • $\begingroup$ Thank you very much, Dimitris, for your response, and for your work, in general. Yes, for each subject I have up to 240 daily samples (those who don't withdraw from the course), which should be enough to use time-series tools. I modeled the daily average of the longitudinal outcome with 1-step-ahead predictions of trend and weekly seasonality, with KFAS, thinking to use them as fixed-effects covariates in the mixed model. I thought that clearly define the marginal trend and seasonality in the mixed model could lead to better estimations of the random effects. $\endgroup$
    – beoeb
    Sep 5, 2023 at 14:36
  • $\begingroup$ in terms of BIC, this model works better than using a spline of the time as a fixed effect. Also, it helped improve the DHARMa diagnostics of the mixed model. But I should try using a spline as random effect, as you suggested, and compare it with the fixed-effect trend+seas that i tried. Trying to put trend and seasonality as random effects, instead, I don't think it would make sense, since they are modeled on the average daily serie - they describe a "marginal" serie. $\endgroup$
    – beoeb
    Sep 5, 2023 at 14:39
  • $\begingroup$ in practice my model is: mixed_model(fixed = y ~ level + y.lag1, random = ~ time | id_student, data = dts7, family = zi.negative.binomial, zi_fixed = ~0 + level + seasonality + y.lag1 , zi_random = ~ time | id_student) $\endgroup$
    – beoeb
    Sep 5, 2023 at 14:47
  • $\begingroup$ However, to use time-serie components as predictors in a mixed model could be a good idea, even though these are unknown beforehand, right? As time progresses, I add new samples to the time-series of my subjects, and the joint model will only use the information available up to now, which means, for the fixed effects will only use the lagged outcome variable and the 1-step-ahead trend and seas estimation available up to now, and this shouldn't give any problem for my JM-predictions, even though these would be endogenous variables (they depend on the past of the outcome). $\endgroup$
    – beoeb
    Sep 5, 2023 at 15:08
  • $\begingroup$ The JMbayes2 package does not yet work with zero-inflated models. If we forget about the zero part, I haven't tried it before fitting a joint model by including the previous value of the covariate in the fixed-effects part. It should work OK, but I would need to double-check to be sure. $\endgroup$ Sep 5, 2023 at 18:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.