I am trying to design an illness-death multistate model (see image below) for survival type data in R. This data is more suited for a Markov model, but the investigator I am working with prefers to use a Cox model. I know from one of the survival package vignettes that coxph can be used to fit unidirectional multistate models. However it is unclear from the vignette if coxph can also handle bidirectional state transitions (e.g., transitioning from "AR Resolved" to "AR Positive" in my model).

My questions are:

  1. Can coxph be used to fit bidirectional multistate data?
  2. If so, can this approach be combined with time-varying covariates?
  3. And can this approach be used with delayed entry start times (i.e., one or more observations enter the study at time t > t0 but all enter in the same state s0).

enter image description here


1 Answer 1


The Aalen-Johansen approach used for multi-state modeling in the R survival package is quite flexible. The (startTime, stopTime, event) way of presenting the data to the functions automatically assumes a multi-state model if event is a factor variable (the only requirement is that reference state of event represents censoring at stopTime), and the software inspects properly formatted data to identify the numbers and directions of transitions, numbers of subjects having each type of transition, etc. See the survcheck() function illustrated in Section 3.4.2 of the main survival package vignette.

Although the worked-through examples in the multi-state vignette all seem to have unidirectional transitions, the approach allows for transitions in either direction between any two states, illustrated at the bottom right of Figure 1 of that vignette. As I interpret section 2.3 of the multi-state vignette, you can even model a transition to the same state (although such situations most likely come from a data-coding error). So coxph() analysis of a multi-state model thus provides time-dependent multi-state modeling without assuming parametric forms of baseline hazards.

With that flexibility, however, comes much responsibility. As the vignettes emphasize, just getting the data into the correct format is often a challenge. Then you have to make serious decisions about how to model.

You show 4 states with 6 transitions. Should all transitions depend on the same covariates? Should covariate coefficients be allowed to differ among transitions, or should some coefficient values be "common" among some transitions? With larger numbers of transitions having independent coefficient values, the number of transitions needed to model without overfitting grows accordingly. Should baseline hazards differ among transitions (like strata in a standard Cox model) or should baseline hazards be "shared" among some transitions? (The "common" coefficient values and "shared" baseline hazard are specified in a list presented to coxph() as the formula for a multi-state model, as shown in both vignettes linked above.)

The (startTime, stopTime, event) format is also what is used for time-varying covariates, so in principle there is no problem incorporating them. There are at least two practical problems. First, if there is a new row representing a change in a time-varying covariate for an individual who doesn't change state, I understand that you need to make sure that the event is shown as a censoring. Otherwise, I think that the system will try to model it as a transition to the same state. Second, there is a danger that the time-varying covariates in practice will have been measured after the transition rather than before, while the modeling needs to use the values in place infinitesimally before the transition.

I am not completely sure about delayed entry. What you describe is left truncation/right censoring or event, which is the default interpretation of (startTime, stopTime, event). That data format in some situations allows for discontinuous intervals of risk for an individual; see Section 3.7.2 of Therneau and Grambsch. With multi-state modeling, however, "individuals are not allowed to have gaps in the middle of their time line" (Section 2.3 of the multi-state vignette). One might interpret that prohibition to mean that delayed entry is OK provided there are no further gaps, but I haven't tried that myself. Test models with and without delayed entry on some sample data.

  • $\begingroup$ Thank you very much! This information was very helpful. $\endgroup$
    – damarsh
    Apr 29, 2021 at 22:05

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.