# How do I vary transition probabilities by cycle (e.g. pdying by age and progression by time)

(e.g. prob of dying by age and progression by time)

• Official comment

There are several ways to incorporate time-dependent values (in this case probabilities) into your model, but they are all based on same fundamental concept - creating a formula that references the _stage keyword.

In Markov models, TreeAge Pro provides a built-in keyword _stage, which is a cycle counter. _stage is 0 in the first cycle, then 1, 2, 3, etc. for each subsequent cycle.

Let's consider one example of background mortality with an annual cycle.

1. Load the background mortality into a table. The index column would contain age, while the value column would contain the probability of background death at that age. We will call that table tMortBackground.
2. Create a set of variables to define the starting age, the current age, and the probability of death at a current age.
- startAge = 50 (this would be set based on your cohort's starting age)
- currentAge = startAge + _stage (this works for an annual cycle)
- pDeathBackground = tMortBackground[currentAge]
3. Place the death probability variable pDeathBackground into the appropriate probability expression(s) in your model.

An example model using this technique is included with your software - Projects View > Example Models > Healthcare Training Examples > Example10-MarkovCancerTime.trex. The variable names may be slightly different in that example.

Note that several adjustments would be needed for shorter cycle lengths.

• The currentAge definition would change slightly for a shorter cycle,  like currentAge = startAge + _stage/12 for a monthly cycle.
• Annual probabilities from the table would need to be adjusted for the shorter cycle length via the ProbToProb function.
• Dear all, I am also just modelling transition states and I do have the same problem. I have 30 cycles and I want to add a probability to every cycyle. Could anyone please let us know how to do this? I checked the manual but could not find anything. Thank you very much,

Andreas

• Dear Andrew,

thank you very much for your support! I followed your explanation and it worked! Regards, Andreas

• Thanks Andrew - very helpful.

Just to check - can I do simultaneously vary the cancer mortality by time as well as by age? (using a table for variables for pCancermort and pBackgroundmort).

Also can the same principle be applied to vary rewards by cycle stage? (e.g. utility decreasing with age?)

Many thanks

• Yes, you can use this technique for as many values (probabilities, costs, utilities, etc.) as you want using different tables and variables. Of course, you would not need separate variables for age calculations, since age is the same regardless of how it is used.

• Dear Andrew,

it is been so long since we talked. I am trying to replicate a model in the software. I just need an assistance regarding the cycle length and time horizon. in the article the cycle length was set as 1 month and it should stop after completing 60 cycles (5 years)? How can I adjust that in the tree preferences?

Thanks

• Tree Preferences would only be affected here if you are using Global Discounting (Tree Prefs > Calculation > Payoffs > Discounting). If you are using that function, set the cycle length to Monthly.

The more complicated part is making sure that all your model values are consistent with the monthly cycles.

• Costs and Utilities (at health states, but not at events)
• Transition Probabilities
• Termination Condition

For example, if you enter annual utilities into a monthly cycle model, you would accumulate 12 times more QALYs than you should.

• Dear Andrew,

Thank you for your help. I have the similar question. The length of a single Markov cycle is 3 months, when I transfered the annual transition probabilities  to quarterly transition probability, the sum of transition probabilities is not 1, how can I solve this problem.

Many thanks

Wen

• Typically, you would have probabilities for events, then the hashtag for none of those events occurred. As the calculated probabilities go down with the shorter cycle, the no event hashtag calculation will go up to make up the difference.

If you need further help, please submit it as a support ticket to support@treeage.com.

Andrew