Markov cohort simulation in R - Time-varying transition probabilities

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ก.ย. 2024

ความคิดเห็น • 15

  • @tallyskalynkafeldens1753
    @tallyskalynkafeldens1753 16 วันที่ผ่านมา

    you're brilliant. Thank you so much!

  • @sjrigatti
    @sjrigatti 4 หลายเดือนก่อน

    Perfect. Thanks for this.

  • @dranujtiwari
    @dranujtiwari 2 ปีที่แล้ว

    Hi, brilliant videos. Do you also use HESIM package?

    • @TMSnowsill
      @TMSnowsill  2 ปีที่แล้ว

      Hi Anuj, I haven't used it, but at some point I think I will try to go through the different existing packages for cost-effectiveness modelling in R. I have used heemod and liked it.

  • @liluding2453
    @liluding2453 3 ปีที่แล้ว

    Dear, I am wounding if we would want to apply the Markov transition matrix to individual-level microsimulation, how do we decide the state of an individual at each round. e.g. if at a certain simulation round, the probability of an individual is (0.6,0.3,0.1) for health, disease, and death, respectively, do we consider this individual as healthy? if yes, does this mean that we will consider the state with the largest probability as the state of this individual at this round? if now, what is the proper approach? Really curious about it. Thank you.

    • @TMSnowsill
      @TMSnowsill  3 ปีที่แล้ว

      Hi - The way it works is that based on the individuals current state you obtain their transition probabilities. These will sum to 1 (assuming you also include 'transitioning' back into the same state). You can then use the R function sample, something like (assuming tp_mat is the transition matrix and current_state is the current state):
      > new_state

    • @liluding2453
      @liluding2453 3 ปีที่แล้ว

      @@TMSnowsill Thank you! Still hard to comprehend. If tp_mat[current_state, ]= c(0.6,0.3,0.1) for health, disease, and death, respectively, which state do we consider this person for the current state? or you mean we assign a current state for an individual then back-calculate the tp_mat, then based on the condition that the role in the tp_mat should sum to 1 to derive the current state vector?
      However, I understand that tp_mat is determined by existing knowledge and the state can be updated by matrix multiplication between state vector and tp_mat. Which should be the first, the current_state or the tp_map?

    • @TMSnowsill
      @TMSnowsill  3 ปีที่แล้ว

      Sure. In a microsimulation, we probably won't actually calculate a single transition probability matrix because one of the most likely reasons we are using microsimulation is because the probabilities of different transitions depend on how long we've been in our current state but we don't want to use tunnel states.
      In practice, you will initialise the current_state for each patient as their starting state (in the healthy, diseased, dead example we would initialise everyone as healthy, but in other models you might sample their initial state according to a probability vector). In a microsimulation, the current_state is always a single state (not a probability distribution over states as we have in a cohort model).
      Given an individual's current_state (and any other quantities you are tracking, e.g., the number of cycles spent in the current state) you would then calculate the risks of the different transitions and produce a vector of transition probabilities which apply for *this individual* in *this cycle*. You then use sample(...) to randomly select their next state but weighted according to the transition probabilities. If their next state is the same as the current state you would increment the cycles spent in the current state, otherwise you would set it to 0.

    • @liluding2453
      @liluding2453 3 ปีที่แล้ว

      @@TMSnowsill Thank you. I will try to digest these ideas and read through the suggested paper. If it's possible, I would like to ask further questions if I have any via email on your page?

    • @TMSnowsill
      @TMSnowsill  3 ปีที่แล้ว

      @@liluding2453 Yes. I'm pretty busy with work so might take a little while to respond and might not be able to handle big/lots of questions. I'm also on Twitter @TMSnowsill I will get mention notifications.

  • @benkamau811
    @benkamau811 2 ปีที่แล้ว

    Hi excellent stuff. Kindly share the code if you don't mind.?

    • @TMSnowsill
      @TMSnowsill  2 ปีที่แล้ว

      Hi ben! I think for most of these the description for the video includes a link to a GitHub gist for the code. Best wishes :)

  • @kadourkadouri3505
    @kadourkadouri3505 2 ปีที่แล้ว

    The example and the color of the commands (red) are so sinister

    • @TMSnowsill
      @TMSnowsill  2 ปีที่แล้ว +1

      Ah! I hope they are not too scary. They are easy on my eyes, but you can use whichever colour theme you like :)

    • @kadourkadouri3505
      @kadourkadouri3505 2 ปีที่แล้ว

      @@TMSnowsill definitely