11.5 Examples of variables with multiple definitions

In this section we look at creating variable definitions which have multiple definitions, depending where you are in the model. This will allow you to review models for variables which change definition based on location.

We will use one of the Get Started example models, Climber Cost.trex, which will provide an example of a variable (Total_Cost) which changes by location in the model. The example compares a new to a standard treatment of antibiotics, where the treatment is aiming to cure foot infections more quickly and prevent the need to amputations. The new drug is already being used, but because it works over a short time frame this is impacting the number of amputations. The data about costs and probabilities are included in the model below.

Implementing a cost formula using variables

To build the model outcome, Total_Cost, so that we can easily reference across the model, we will create a cost formula. As you can see in the figure above, most of the variables we require in the model are already defined at the root (decision) node.

Much of the work required to make the tree more flexible has already been accomplished. All necessary variables have been created in the tree, and each has at least one definition.

The main tasks which makes the model flexible is the different definition of Total_Cost in the different scenarios.

The definition of Total_Cost from the Variables View is:

  • Total_Cost = cHosptial + cTreatment + cProsthetic + cPhysTher

This gives the modeller the flexibility to use Total_Cost as the payoff for all scenarios. But in each scenario the elements cHospital, cTreatment etc are all different.

To calculate the payoff of any node in the tree, TreeAge Pro must evaluate Total_Cost. To do this, it will search start searching for a definition of Total_Cost at the terminal node, and work leftward until it finds a definition. In this case, the first definition it will find is the default definition of Total_Cost from the root node.

The component variables cHospital, cTreatment, cProsthetic and cPhysTher need to be evaluated. TreeAge Pro restarts the search for each variable’s definition at the terminal node which is being calculated. This right-to-left search is restarted for each variable encountered in the calculation.

Therefore, for every path in the tree, each variable in the cost formula must have an appropriate definition. Note that for some outcomes, some components do not apply. For example, there are three terminal nodes which represent non-amputation scenarios, and which therefore have no prosthetic or therapy costs. These components should have 0 values in these paths. The model has appropriate variable definitions in the model. For example, at the Amputate foot node, you will see three additional variable definitions (for variables cTreatment, cPhysTher and cProsthetic). You can see this in the figure below with all the variables definitions throughout the model.

Lets consider two different pathways and how the calculation of Total_Cost varies. .

Pathway: Use standard antibiotic > FootSaved.

  • cHosptial =cPerDiem * numdays

  • cTreatment = cAntibiotics

  • cProsthetic = 0

  • cPhysTher = 0

  • Total_Cost = 4500 (see rolled back model below)

Pathway: Amputate foot.

  • cHosptial =cPerDiem * numdays

  • cTreatment = cFootAmpu

  • cProsthetic = cFoorProsth

  • cPhysTher = cFootPhys

  • Total_Cost = 24000 (see rolled back model below)

All payoff values are set to the variable Total_Cost, but the value are different for each terminal node, as you can see in the figure below in Rollback.