6.2 Adding the Markov Node
You need to use a Markov node to start a Markov Model. Any number of Markov nodes can be included in a model. In our example, the chance node which comes after the root node will be changed to a Markov node.
We will begin with a model which has a number of key elements already added. These include the model inputs (added as variables) and the model outputs which have been configured using the Model Setup Wizard (covered when we built a Decision Tree). The figure below shows you the model, Markov Cancer Start.trex, that we will start from.
To create a Markov node:
-
Open Example model Markov Cancer Start.trex.
-
Right-click on the chance node and choose Change Type > Markov from the context menu.
-
Label the Markov node Tx 1 as the text description of the node.
Below the purple Markov node symbol, TreeAge Pro adds a Markov information box; this is where you add the Termination Condition. When analyzing a Markov model, TreeAge Pro uses the termination condition to determine whether a cohort analysis is complete. TreeAge Pro evaluates the termination condition at the beginning of each cycle. If the condition is true, the Markov process ends, final rewards are assigned if necessary, and the results are reported.
To set the termination condition:
-
Select the Markov node.
-
Choose Views > Markov from the toolbar.
-
On the Markov Node tab, in the Termination conditions > Term Cost-Eff, enter the termination condition _stage = totalCycles.
In this example, the termination condition of _stage=totalCycles (where totalCycles = 20) would run for 20 cycles (_stage 0 - 19, stopping before _stage 20). Note that is not necessary to use a variable as this will not usually change.
Tracking time with _stage
A Markov model has a built-in counter called _stage, which TreeAge Pro sets equal to 0 before the first cycle and increments by 1 before each subsequent cycle (i.e., before assigning state rewards). You can reference _stage anywhere within the model (from variable definitions, to logical formula) to calculate values which are time dependent. The termination condition is an example of this where we ask the model to stop once _stage has reached a certain value.
More about Termination Conditions
The termination condition can be simple or complex expressions, referencing variables, distributions, other keywords, etc. For example, you might want to run until a variable age is over 75. In such a case, the following termination condition would be used: age > 75. The termination condition can also include multiple conditions, using the logical operators &, | and !, which represent AND, OR and NOT operators respectively. For example, if you wanted the model to run for 50 years or until the age is over 75, the following termination condition would be used: _stage = 50 | age > 75.
TreeAge Pro allows you to set a default termination condition for all Markov nodes. Once set, you will have the option at each Markov node to change the default termination condition of one or all other Markov nodes.
To set the generic termination condition:
-
Open the Tree Preferences > Calculation > Markov.
-
Set the default termination condition as required for all Markov nodes.