From Expanded Histories to Transition-Specific Models
After multi-state histories have been expanded, a subject may contribute several rows: one for each transition-specific risk interval in which that subject is at risk. The next task is to describe how covariates relate to the intensity of each transition. A transition-specific Cox model allows both the baseline transition intensity and, when needed, the covariate effects to differ by transition.
This is not a model for a single time until “any event.” Each transition has its own event indicator and risk set. A subject who moves from one state to another may enter a later transition risk set, while a subject who has not yet entered the relevant state is not at risk for that transition.
In the expanded data, the usual counting-process fields are Tstart, Tstop, and status, together with a transition identifier such as trans. A row represents a subject at risk for one transition over \((\text{Tstart},\text{Tstop}]\); status is 1 if that transition occurs at the interval end and 0 otherwise. The data also retain subject identifiers and covariates. Check the actual field names and coding in the object produced by msprep before fitting.
The model assumes that, within each transition, the covariate effect is proportional over the selected time scale unless time-varying effects are specified. The risk intervals and event codes must correctly represent the observed histories; censoring must be conditionally non-informative for the transition intensity being modeled; and subjects must be independent for the ordinary likelihood-based analysis. Covariates must be measured and encoded appropriately, including their values over each interval if they change over time. A Markov assumption is not required just to fit these conditional transition-intensity models; assumptions needed for particular prediction targets are a separate issue.
Specifying Separate Effects in coxph
In coxph, Surv(Tstart, Tstop, status) identifies the counting-process response. Including strata(trans) gives each transition its own baseline hazard. That alone does not give each transition its own covariate effects: an un-interacted covariate in the formula has a common coefficient across transitions.
For transition-specific effects, mstate::expand.covs creates transition-indexed covariate columns. For example, expanding a binary treatment variable creates a treatment column for each transition. Including those columns together with strata(trans) permits a separate treatment coefficient for each transition and a separate baseline hazard for each transition. Use the names actually produced by expand.covs; they depend on its options and the transition indexing.
trt.1, trt.2, and trt.3, a transition-specific fit has the form coxph(Surv(Tstart, Tstop, status) ~ trt.1 + trt.2 + trt.3 + strata(trans), data=msdata, method="breslow"). Each coefficient applies to its indexed transition; the strata provide the transition-specific baseline hazards.
The Breslow tie method is commonly used in this workflow and is appropriate to specify explicitly when the fitted object will be passed to mstate::msfit. If there are repeated records per subject, the rows are not independent observations. For robust subject-level inference, a subject identifier can be supplied as a cluster in coxph, provided the downstream procedures support the resulting variance specification. Clustering changes the variance estimate, not the fitted coefficient estimates. Confirm the model and variance structure required by the analysis rather than adding a cluster term mechanically.
Worked Example: Fitting Separate Treatment Effects by Transition
Suppose a hypothetical illness-death analysis has transitions 1 (healthy to illness), 2 (healthy to death), and 3 (illness to death). An expanded data object called msdata contains Tstart, Tstop, status, trans, a subject identifier id, and binary treatment trt, coded 0 or 1. Assume the expansion has been checked: each row belongs to the correct transition risk set, event indicators match the histories, and the time scale is time since study entry.
First create transition-indexed treatment columns with msdata <- mstate::expand.covs(msdata, covs="trt", append=TRUE). Suppose inspection confirms the resulting columns are trt.1, trt.2, and trt.3. Fit fit <- survival::coxph(survival::Surv(Tstart, Tstop, status) ~ trt.1 + trt.2 + trt.3 + strata(trans), data=msdata, method="breslow"). These three columns give transition-specific treatment effects; the strata permit separate baseline intensities. The specifications are suitable only if the proportional-hazards assumption for treatment is reasonable within each transition and the expanded risk intervals are correct.
Assume, solely for illustration, that the hypothetical fitted coefficients are \(\hat\beta_1=-0.357\), \(\hat\beta_2=0.182\), and \(\hat\beta_3=-0.105\). The treatment hazard ratios are obtained by exponentiation: for transition 1, \(\exp(-0.357)=0.700\); for transition 2, \(\exp(0.182)=1.20\); and for transition 3, \(\exp(-0.105)=0.900\), to three significant figures.
Thus, conditional on the model and the risk set for each transition, the fitted treatment intensity is 30.0% lower for transition 1, 20.0% higher for transition 2, and 10.0% lower for transition 3, relative to the untreated group. These are associations in transition intensities, not causal conclusions. Uncertainty and the relevant study design would need to be considered before making stronger claims.
Why the Transition-Specific Likelihood Works
For transition \(r\), let \(Y_{ir}(t)\) indicate whether subject \(i\) is at risk for that transition at time \(t\), and let \(N_{ir}(t)\) count occurrences of that transition. Under the transition-specific proportional-hazards model, the contribution to the partial likelihood is formed from event times for that transition and the subjects in its risk set. With no tied event times, its factor for event subject \(i\) at time \(t\) is the subject’s relative intensity divided by the sum of relative intensities over the risk set.
Here \(\mathcal{D}_r\) is the set of observed event times for transition \(r\), and \(i(t)\) is the subject experiencing that transition at time \(t\). Separate baseline hazards cancel from this partial likelihood. When each transition has its own coefficients, the transition-specific likelihood factors can be maximized with their own covariate effects; the stratified Cox representation implements distinct baselines while the expanded covariate columns encode distinct slopes.
For tied events, the Breslow approximation at time \(t\) with \(d_r(t)\) events uses the denominator raised to the event count. The corresponding increment of the Breslow cumulative baseline hazard is \(\Delta\widehat H_{0r}(t)=d_r(t)/\sum_{j:Y_{jr}(t)=1}\exp\{\hat\beta_r^{\mathsf T}x_j(t)\}\). This makes explicit why a wrongly coded risk set or event count affects both the coefficient fit and the estimated baseline hazard.
Obtaining Transition Cumulative Hazards with mstate
The fitted coefficients summarize relative transition intensities. For later multi-state prediction, an absolute transition-hazard scale is also needed. The mstate::msfit function uses a fitted Cox model, a specified covariate profile, and the transition matrix to organize estimated cumulative transition hazards. It returns transition-indexed hazard information; it does not itself turn that information into state-occupation probabilities.
When transition effects use expanded columns, supply a profile consistent with the expansion. For a treatment profile with value 1, each transition-indexed treatment column should have value 1 for that profile; for value 0, each should have value 0. Include any other covariates required by the fitted formula, and use the same transition matrix that defines the transition indexing in the expanded data. Check that the supplied profile has all model variables and that the matrix and model use the same transition labels.
Worked Example: Reading a Profile-Specific Cumulative Hazard
Continue with the hypothetical three-transition fit. Suppose a profile-specific calculation for untreated subjects gives an estimated cumulative transition hazard for transition 1 of \(0.20\) by month 12. Suppose, for illustration, the corresponding baseline cumulative hazard is also \(0.20\), since all treatment columns are 0 for this profile. If the fitted transition-1 treatment coefficient is \(-0.357\), the treated profile’s cumulative hazard under the model is \(0.20\exp(-0.357)=0.20(0.700)=0.140\) by month 12. The units are cumulative hazard by month 12, not a probability of transition by that time.
In R, prepare a one-row newdata object with the required expanded columns set to the profile values, and call msfit(fit, newdata=newdata, trans=tmat), where tmat is the transition matrix used to encode the model. The output’s rows are organized by transition and time. Inspect the returned object and verify that the transition identifiers and cumulative-hazard values correspond to the intended profile. The numerical values above are hypothetical arithmetic to illustrate the hazard-ratio relationship, not the output of an actual dataset.
Worked Example: Auditing the Expanded Covariates
Suppose there are two transitions, numbered 1 and 2, and a binary covariate risk. After expansion, a row for transition 1 has risk.1=1 and risk.2=0 when the subject has the risk factor; a row for transition 2 has risk.1=0 and risk.2=1. For a subject without the factor, both values are 0 on either transition row. This is the intended structure for the formula risk.1 + risk.2 + strata(trans).
Now suppose inspection instead finds a transition-1 row with risk.1=1 and risk.2=1. That row would contribute risk-factor information to both transition-specific terms, although it represents only transition 1. Do not fit the model in that state. Recreate or correct the expanded columns, then verify the pattern across transitions and covariate values. This audit checks the design matrix against the intended model before any coefficient interpretation is attempted.
Diagnostics, Alternatives, and Limitations
A successful software call is not evidence that the model is correctly specified. Before interpretation, check that transition identifiers match the transition matrix, that each event is assigned to the correct transition, that the time intervals and event status are sensible, and that covariates do not change unexpectedly across rows. Inspect event counts by transition and the number of subjects at risk; sparse transitions can yield unstable or non-estimable coefficients. Look for warnings about convergence, singularity, or infinite estimates, and inspect coefficient standard errors and confidence intervals for signs of weak information.
The proportional-hazards assumption should be considered separately for each transition and covariate. Schoenfeld-residual checks and graphical or time-interaction assessments can reveal time-varying effects. A strong violation means that a constant transition-specific hazard ratio may be inadequate; a transition-specific time-varying effect or another model may be needed. Also examine whether covariate coding and missing-data handling are consistent across the expanded rows. One subject’s original covariate value should not accidentally be counted as a different value merely because the history was expanded.
The main alternative structures include a shared covariate effect across transitions, transition-stratified models with common slopes, and separate model fits for each transition. A common slope is more parsimonious but imposes equality of effects; separate fits are straightforward to inspect but require care to keep risk sets and covariate handling aligned. Choosing among these structures is a modeling decision, not a software default. Transition-specific models also do not automatically solve sparse-data problems, unmeasured confounding, informative censoring, or misspecification of the time scale.
strata(trans) but a single unexpanded covariate does not have transition-specific covariate effects. Stratification changes the baseline hazards; the coefficient remains shared. To estimate distinct effects, include transition-indexed covariates (or an equivalent explicit interaction) and confirm that their values are coded for the intended transition.
Confirm interval endpoints, status, transition labels, risk-set membership, and subject identifiers before fitting.
Use transition-indexed covariates for transition-specific slopes and strata(trans) for transition-specific baseline hazards.
Use the intended tie method, review convergence and event counts, and assess proportional hazards within transitions.
Supply consistent newdata and transition indexing to msfit, then verify the returned transition-specific cumulative hazards.
Check Your Understanding
Answer each question, then compare with the short solutions below.
- What does
strata(trans)allow to differ, and what does it not allow to differ by itself? - For a coefficient estimate of \(-0.223\), calculate the hazard ratio and interpret it for that transition.
- Why is a cumulative transition hazard of 0.14 not a 14% transition probability?
- Name two checks to perform if a transition-specific coefficient has an extremely large standard error.
Solutions. (1) It permits a separate baseline hazard for each transition, but an unexpanded covariate still has a common coefficient. (2) \(\exp(-0.223)=0.800\) to three significant figures; the fitted transition intensity is 20.0% lower per unit contrast in that covariate, conditional on the model. (3) A cumulative hazard is an integrated intensity, not a probability; transition probabilities depend on the event process and competing transitions. (4) Check event and risk-set counts for that transition, convergence and separation-like behavior, and the expanded covariate coding. Any two of these are appropriate checks.