jmstate PyPI package
A person’s health rarely follows a single straight line. Cognitive decline, physical dependency, hospital readmissions — these processes unfold in parallel, influence each other, and interact in ways that no single model traditionally captures well. This is the problem that Félix Laplante and I set out to address in a recent paper , and that the jmstate python PyPI package was built to solve.
The idea behind joint multi-state models is straightforward: link a longitudinal biomarker trajectory (a continuous measurement repeated over time) to a multi-state process (transitions between discrete health states) within a single probabilistic model. The two processes share latent random effects, so the model can estimate, for instance, how a patient’s current cognitive score influences the risk of moving from mild to moderate physical dependency. Classical joint models already do something like this, but only for a single terminal event — typically a binary alive/dead outcome, as implemented for example in the JMbayes2 R package. More recent work extends joint models to multi-state settings, but still under a directed acyclic graph (DAG) assumption: every transition goes forward, and no state can be revisited. jmstate lifts both of these restrictions. It works on an arbitrary directed graph — not necessarily acyclic — which means a patient can return to a state they have already visited (e.g. hospital discharge followed by rehospitalisation). This makes it possible to handle competing risks, intermediate states, recurrent events, and monotone progressions all in the same framework, something neither classical two-state joint models nor DAG-constrained multi-state extensions can do.
All of this is available through the jmstate package. The paper is on arXiv, and the scripts to reproduce the analysis are included in the companion github repository