### Back to business

So first things first, it’s been a long time since I posted anything. This was to be expected. I’m lazy and easily distracted, so maintaining a blog was never going to work…

$~$

`multistate`

version 2.0.0

I’m excited about this update. It’s a big one. Primarily motivated by a new course that Paul Lambert and I taught in January at the Swiss Winter Epi School (we should be there again next year), I spent most of the new year developing the package and adding some new features. That also included a lot of re-writing of the main sourcecode of `predictms`

, a job which I tend to enjoy. Thankfully, it also provided some speed gains!

There are some important updates:

- cyclic transition matrices are now allowed - this was the feature I got asked for the most, the ability to return to a previous state.
- Aalen-Johansen estimator can now be used - this is really useful, you can use the AJ estimator, but with inputs from parametric models (i.e. estimated cumulative hazards functions). All you need to do is add the
`aj`

option. I’ll admit the simulation approach that we favour can be a bit computationally intensive, so if you can use the AJ estimator (only with a Markov model though!), then do. Just make sure to predict at many time-points (e.g. 1000), as it assumes a piecewise constant approximation. - standardised/population-averaged predictions are available - this is new stuff (ish), and we’re working on a paper at the minute. See this paper by Gran et al. (2015). Just add the
`standardise`

option. - user-defined predictions can be calculated - we were pleased with this addition. You can now write a little Mata function to calculate bespoke predictions, i.e. functions of either transition probabilities or the length of stay in each state. I’ll do a future post showing an example of this.
- transition-specific timescales can be used - really new stuff, with a paper currently being written by Caroline Weibull (yes, that Weibull…working in survival analysis…mind blown, right?!) who’s a PhD student at Karolinska Institutet. This let’s you use, for example, time since diagnosis for some transitions, and attained age for others.
- calculate the probability of ever visiting each state within a time interval - simple, yet a nice addition.
- infinite (ish)
`at#()`

s are now allowed to calculate predictions at multiple sets of covariate patterns. They can then be compared by calculating differences or ratios relative to a reference`atref()`

- all predictions can be calculated in one call to
`predictms`

- this is really useful, given the simulations can take some time, being able to calculate lots of different predictions for a given covariate pattern, without having to do multiple simulations, is pretty powerful

There’s also some new commands added to the package:

`msboxes`

, written by Paul, which produces really useful summary graphics of your multistate model, with boxes representing transitions and arrows showing possible paths between states, along with number of observations leaving and entering each state. This is based on Bendix Carstensen’s`boxes`

command in R.`msaj`

, also written by Paul, which calculates the non-parametric Aalen-Johansen estimator of transition-probabilites - essentially the Kaplan-Meier extension for multistate models.`stms`

, written by me and described here, has finally be added to the package. It allows you to fit a model with different distributions for each transition, yet still estimated simultaneously, and so you can share parameters across transitions. Whether you ever wish to do that is a whole other question…it was fun to write though.

It’s now on SSC, so type `ssc install multistate`

to install it, or run `adoupdate`

to update your old version. I’ll add a development version to this website soon as well, as a precursor to polished versions being put on the SSC archive.

### Predicting the future

There’s loads more to do with this package (I have a list), but some related things to mention are that I will be advertising a PhD studentship to join my group, to start October 2018 at Leicester to work on multistate survival models. We’ll also be running our competing risks and multistate models course in Leicester some time in October. It’ll be advertised on Allstat etc. when registration opens. We can’t promise the same experience as a Swiss Winter School though…