hesim-dev / hesim

Health economic simulation modeling and decision analysis
https://hesim-dev.github.io/hesim/
62 stars 17 forks source link

simulate individual transition time and states #13

Closed sdaza closed 3 years ago

sdaza commented 4 years ago

Hello,

Thanks for your nice package.

I wonder if there anyway to recreate individual simulated data with states and time info. Example:

id from to time status
1  1 2 3 1
1  1 3 3 0
...
dincerti commented 4 years ago

Hi and apologies for the delayed response.

The package cannot currently do this because it does not simulate right censored data. If you did not care about the status column, then you could fit a parametric multi-state model with flexsurv and then simulate it as in the multi-state modeling vignette ignoring the costs and QALYs part.

If you need the status indicator, I believe you could estimate time to right censoring for each transition (e.g., with flexsurv). You would then use these distributions to simulate time to right censoring for each transition. A patient would be censored (i.e., status = 0) if the right censoring time was less than the actual time to the next state. The observed time would be the minimum of the right censoring time and the "latent" time simulated with hesim.

An alternative option is to try mstate::mssample() which looks like it has a cens argument.

dincerti commented 3 years ago

As an additional follow-up, this can be implemented in hesim fairly easily with minor extensions to the existing functionality. I've done so in a 3-state case. I'm going to close this issue and open a new issue requesting this as a feature enhancement.