ajsims1704 / rdecision

Decision Analytic Modelling In Health Economics
1 stars 0 forks source link

The sum of the probabilities of the reaction edges emanating from a chance node in a decision tree is not checked. #6

Closed ajsims1704 closed 1 month ago

ajsims1704 commented 2 months ago

Checking that the probabilities associated with a chance node sum to unity is left to the modeller. This should be done by rdecision in the DecisionTree class (evaluate method), and is more convenient to do so in the case of PSA where probabilities may be sampled from distributions and should be checked for each run of the model.

Related, class DecisionTree should permit the probability of at most one reaction edge to be set to NA, identifying it as the reaction whose probability should be set to one minus the sum of the other reactions leaving a chance node at each iteration, similar to what is done with outgoing transition probabilities in semi-Markov models.

ajsims1704 commented 1 month ago

Added a test to method evaluate in class DecisionTree to check that the sum of probabilities for each strategy is one, for each run. Confirmed that the check operates correctly when the conditional probabilities of traversing an edge are scalars or ModVars.

ajsims1704 commented 1 month ago

Added facility to set the probability of at most one reaction edge from each chance node in a decision tree to NA. The missing value is replaced at each evaluation of the tree by a value which ensures that the sum of probabilities for all reaction edges leaving the node sums to unity. This avoids the need to create expression model variables to represent 1 - p where p is sampled from a Beta distribution, for example. Revised the Tegaderm vignette to demonstrate this feature.