Challenges

We have come across some challenges and interesting problems in decision modeling in R. We welcome your thoughts and contributions. Don’t hesitate to email us your solutions, we will be very happy to review them and discuss with you.

Improving the ‘samplev’ function, an efficient approach of sampling health states for individuals in microsimulation models

We have created a function that vectorizes the process of sampling from a multinomial distribution for microsimulation modeling. The most conventional way of running microsimulation models in R is to have two for loops: one for looping through the individuals and another for looping through the cycles in the time horizon. This is often quite computationally heavy when the number of individuals or cycles gets large. To improve the computational efficiency, we have created a function called ‘samplev’ that samples the health states of all individuals in the next cycle in one go from a multinomial distribution. This allows us to eliminate the for loop for the individuals. We further improved the efficiency by vectorizing the multinomial sampling process. The code for the function and a three-state microsimulation model that uses the function can be found here.

Open-cohort microsimulation models

 Most microsimulation models simulate a group of individuals with different characteristics at cycle 0 and model their transitions (to different health states) at each cycle, through all cycles. Costs and outcomes are then aggregated across all individuals and discounted over all cycles. However, in the real world it is possible that new individuals enter the group as time goes, in which standard microsimulation model structure does not account for. In light of this, we challenge you to think about ways to implement an ‘open-cohort’ microsimulation model in R where individuals can enter the group at any cycle. 

 

 

Close Menu