Include step function into Joint longitudinal and time to event model

I am fitting a joint longitudinal and time to event model on production data with the aim of making dynamic predictions of the time of assembly of a machine. I am using JMbayes R package.

Among the time-dependent variables in the longitudinal part of the model I have a dummy variable that tells whether the mechanical part of the assembly is finished or not, this variable is 0 up to a certain time point, thereafter it becomes one from the time the mechanical part is completed to the time of the event (the assembly has been completed). So basically it is a one step function.

Now I am fitting a binomial(link="logit") longitudinal model for this variable using time fixed effect and a random effect for the order number related to the machine being assembled. I am linking this longitudinal model to the time event component using the "current value" association.

The idea is that if I complete the mechanical part of the assembly ahead of the historical average, it is likely that the total time of assembly will be lower, coversely if I spend much more time, it is likely that it will be higher.

I am sure this is not the right way to include this kind of variable in the model, both in modelling it in the longitudinal part of the model without taking into account that this is a binary step function over time monotone non-decreasing, and also for the way I linked it to the time component i.e. using the current value association, since the impact of the value of this variable depends on time: its value is always 0 during the first days of assembly and only from a certain time onwards it is informative.

Could you help me correct the model definition?

• @Motmot the (start, stop, event) format for survival data, along with an id for each individual, can be used for time-varying covariate values, with start, stop representing the time period over which covariate values are constant at the specified values on that data row for the individual. Multi-state models are handled with event as a factor variable instead of the usual 0/1 censored/event. I don't have personal experience combining time-varying covariates with multi-state models, however, so I'm not completely sure that those can be done together. – EdM Jan 31 at 22:46