chjackson / flexsurv

The flexsurv R package for flexible parametric survival and multi-state modelling
http://chjackson.github.io/flexsurv/
55 stars 27 forks source link

Expected number of visits from a `fmsm()` model #153

Open mattwarkentin opened 1 year ago

mattwarkentin commented 1 year ago

Hi @chjackson,

Is it possible to estimate the expected number of visits in each state from a flexsurv::fmsm() model? Similar to the envisits.msm() function from the {msm} package.

I guess I have the same question about sojourn times, also. Or more generally whether there are summary metrics that can be obtained from msm models that aren't supported for fmsm models (e.g., efpt, pnext, ppass).

chjackson commented 1 year ago

For semi-Markov models, in general, you can get any summary statistic via simulation (sim.fmsm). This is how I'd generally prefer to specify a flexible multistate model - I think it's usually more useful to conceive risk of the next transition as a function of the time since the previous transition, rather than the time since time zero.

For Markov models, I expect all the things you mention are mathematically possible but don't have handy interfaces - so someone could compute them if they understood the appropriate theory. For example, I think the expected number of visits could be calculated by solving a differential equation, in the same manner as the total length of stay.

Though I think the mean sojourn time would be easier under a semi-Markov model - it's just the mean of the appropriate time-to-event distribution, which is available for all distributions in the package.