chjackson / flexsurv

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

pmatrix.fs - specifying a different starting time? #100

Closed eiriksko closed 3 years ago

eiriksko commented 3 years ago

I enjoy and have started working with the multistate capabilities of flexsurv. I wonder if it is (or will be) possible to specify a starting time point other than 0 (zero) when making predictions from a set of parametric survival models. E.g., if an individual is in state 2 at time =5 (or, by specifying a vector of state probabilities at time =5); would it be possible to predict the state probabilities at time =10?

Best, Eirik

chjackson commented 3 years ago

Currently if the model is semi-Markov you can use simulation to summarise any function of outputs. e.g. for a transition probability, you could use sim.fmsm to simulate the population, and calculate the number of people who were in state 2 at time 5 and each potential state s at time 10. To get confidence intervals there is a function bootci.msm, but that would be computationally intensive.

If the model is Markov, a more efficient way would be to use differential equation solving as is done by pmatrix.fs, though I'm not immediately sure how to formulate it. I'll keep the issue open as a potentially useful feature.

eiriksko commented 3 years ago

Thank you for the swift response. I'll try and see if I can make it work.