hesim-dev / hesim

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

Adding in incidental costs to cost model #9

Closed aheff closed 4 years ago

aheff commented 4 years ago

Is it possible to add in costs incurred from transitions between states? As far as I can tell, costs for now relate to state occupancy only rather than state movements.

A typical example would be a cost of death - meaning (in the language of the cohort DTSTM vignette) applying a one off cost to any flow from C -> D?

Similarly, in the model I'm trying to reproduce having costs that accrue initially upon transition to other categories would be a valuable feature (which may be in the package already so apologies if I've just missed it). An example would be adding a cost when transitioning to state B because entering that state incurs a diagnostic test or something like that.

dincerti commented 4 years ago

I think the most straightforward way to add in costs of death would be to create a tunnel state that only lasts for one Markov cycle prior to death.

I'm not entirely sure I understand the question in the last paragraph. If the question is whether costs can depend on time in the state, then there are two ways to do this. First, you could create tunnel states. Second, you can use the argument time_reset = TRUE in a stateval_tbl (link), but this option is only available with an individual patient simulation (and is incidentally one of the reasons I'm planning to building functionality for simulating a IndivCtstm from transition probability matrices as you asked about previously).

aheff commented 4 years ago

Thanks - I imagine the tunnel state is the way to go in both cases though this could significantly increase the number of states and complexity (so likelihood of error).

If I could make a feature request which I think will be very useful to others using this package: it's to be able to specify costs associated with moving from state to state. Ideally I could enter a matrix just like the transition matrix which says: if I go from A -> B or C -> death etc that incurs a one-off cost of $X.

In my line of work it's common not only to want to specify ongoing medical or drug costs etc (as your package allows for already) but also to be able to specify one-off costs to account for diagnostics, one-off treatments (like liver transplants) and so on that only occur once during a transition between states.

I hope this has made it clearer; as a hack, your tunnel state idea would do this, but if what I've outlined above is remotely feasible, it would be a great addition to the package.

Let me know if this is unclear and I can give a worked example.

dincerti commented 4 years ago

Got it, I can give that some thought and think about how it might be implemented. And as a question, is it more important to have costs for specific transitions (e.g., A -> B) or just costs that vary as a function of time spent in a state? It seems like either would work for the one-off costs you alluded to?

The latter can currently be done in an individual patient simulation. For example, the $sim_costs() method for an IndivCtstm () lets you specify the duration over which costs are incurred. Moreover, time intervals can be used with a stateval_tbl so that costs vary as a function of time in the state (if time_reset = TRUE) or from the start of the model (if time_reset = FALSE).

aheff commented 4 years ago

In terms of the cohort models I think the two options do different things - both of which are useful:

  1. Costs for specific transitions allow for one-off costs like certain types of treatments, vaccines or diagnostics to be accounted for.

  2. Time-varying costs (e.g. the cost of being in state A varying as a function of cycle n) would be useful for incorporating changes in drug prices perhaps - but otherwise this is a feature I hadn't really thought about.

I think I can see how the second feature could give you the first for iCTSTMs: I'm guessing you would set it up so that the one-off cost happens the first cycle (or time-step) an individual is in a given state and then not after that.

But for cohort models I don't think the two are equivalent: to do the first thing you simply need to log the number making a particular transition (e.g. A->B) and then multiply by the cost of that transition. I can't see how this can be achieved by varying costs as a function of time spent in a state (in the cohort model approach).

aheff commented 4 years ago

PS what would be useful is time-varying transition probabilities in the cohort model part of the package - e.g. so death rates can be specified over time to simulate the cohort getting older. I think a lot of this is done in the iCTSTM version of hesim, but this requires fitting to data which I don't yet have - hence using the cohort variant.

dincerti commented 4 years ago

Luckily most of those features are in the current package, the only one that is not is transition specific one-off costs. I think those would be useful for cohort models and it wouldn't be terribly hard to add so I'll plan to add that as a new feature.

As for the rest:

Alik-V commented 2 years ago

Hi @dincerti, thanks for the ongoing development of the package!

I am facing a similar issue as the original poster where I need to specify one-off costs associated with a transition into death state but this time in a context of a PSM. I've been looking through package changelog since the issue date and I am unsure if you have implemented a solution for that, apologies if I missed it.

If the feature is not included, would using an additional tunnel state still be recommended?

dincerti commented 2 years ago

Hi @Alik-V this has unfortunately still not been implemented. You can specify one-time costs, but only those that accrue at time 0.

The workaround is to either include a tunnel state as you note or to use an individual-level simulation.

Alik-V commented 2 years ago

Hi Devin, thank you for your reply!

Sorry if it's a dumb question, but how would a tunnel state work in case of PSM?

Since a tunnel state would be a separate state in PSM, is there a way to make sure that a patient incurs the end-of-life cost through the tunnel state before progressing to death?

With a tunnel state, I would have 4 states and 3 curves: PFS, OS and tunnel state curve. How would I derive the tunnel state curve?

dincerti commented 2 years ago

@Alik-V you would need to use a Markov model to incorporate tunnel states. The survival models can be used to derive time-varying transition probabilities.