# Including confidence intervals in a Markov's transition probabilities

Hi there,

I am running a Markov and I am wondering how can I incorporate the confidence intervals of the transition probabilities so they are reflected in the state probability and survival curves.

Thank you in advance

## Comments

David NaimarkConfidence intervals around a transition probability can be handled by running the Markov as a PSA (i.e. Monte Carlo with samples) and selecting transition probabilities from a beta distribution. The latter has an alpha parameter with is equal to the number of 'successes',S, in N patients and beta, which is N-S. If you have a transition probability and confidence intervals, you can estimate the SD and use it and the mean (S/N) to set up the beta distribution.The PSA will give you an idea of the variability in the output of the model (i.e. QALE and costs), but not necessarily the variability in state membership.

Determining the variability in state membership versus time will take a little more effort.

For the latter, set up the beta distributions as mentioned above and set the Markov to run as a 2D simulation: i.e. Monte Carlo with samples+trials with the microsimulation trials run in parallel. Use global matrices to record state membership as a function of cycle number and outer loop iteration number. To do this, create a special variable _monte_post_sample_eval at the root and set it equal to globalnset(branchno;_stage+1;_sample;stateprob(branchno))

Here branchno is the number of the branch off the Markov node representing a given state - i.e. the first branch (state) off the Markov node has 1 as the value of branchno. You would need to set up a similar expression for each state for which you want to determine state membership variability. These expressions are 'added' together - i.e. globalnset(1;xxx)+globalnset(2;xxx)+....+globalnset(n;xxx) for 'n' states that you are recording.

Each global matrix now has the proportion of the cohort in a particular state (specified by branchno) with each row representing a cycle number and each column representing the outer loop iteration number.

Finally, create another special variable at the root _post_analysis and set its expression as globalnexport(1;1)+globalnexport(2;2)+....+globalnexport(n;n)

These will dump the results into text files when the simulation finishes that you can then view outside of TreeAge. For a given state, the variability in state membership at a particular cycle number is the variability across that row in the text file.

Hope this helps

David NaimarkSorry - I realized my global matrix expression above won't do the job.....give me a minute

David NaimarkThe global matrix expression is right, it's just timing the execution of it won't work with _monte_post_sample_eval.

Acch, so sorry.

Instead, you could create a variable at the root called 'globalwrite' and set it's expression to the globalnset()+...+globalnset() as in my previous response. In the incremental utility box of each Markov branch (each state), add a term to the incremental utility expression that is 0*if(_trial = _trial_size; globalwrite;0).

When the inner loop, the microsimulation part, runs in parallel, all of the trials advance one cycle and then all of the trial's run another cycle. The _trial = _trial_size is true when the trial being evaluated is the last one. So we get all of the trials to run through a given cycle and then, on the last one, we record current state membership to the global matrix or matrices.

The necessity of running the microsimulation inner loop in parallel is that it allows stateprob() to work. In a parallel simulation, stateprob(x) returns the proportion of trials in state 'x'.

TreeAge also has extensive time reporting features but, to get at what you want, I think global matrices will make it easier.

D

Felipe ForeroHi David, Thank you very much for all this! :) I probably forgot to mention that I am quite new in treeage, hence most of your steps seem a bit complex, but you have nicely explained in detail so I'll try to follow your comments. Thanks a lot!

Andrew MunzerDavid,

Thanks for adding to this thread.

I think there are two elements to your post, the inputs related to parameter uncertainty and collecting variability in state membership as an output. I am not sure whether Felipe wants/needs the latter.

The first part relates to using distributions to drive probabilities with time within probabilistic sensitivity analysis (PSA). I agree with your description.

If Felipe doesn't need to collect variability output data about state membership by cycle, then he can skip the global matrix stuff, which is quite complicated to implement.

Sincerely,

Andrew

Please sign in to leave a comment.