35.4 State/Transition Probability Functions

There are other functions with “Prob” in their names that are not used for conversion between rates, probabilities, or odds. The functions listed here have special applications in Markov models. See the section on Dynamic cohort models later in this chapter for details.

Function Explanation

StateProb(i)

Returns the state probability of state #i at the start of the current cycle. If running a microsimulation, parallel trials are required or returns as 0. In dynamic models using non-coherent probabilities, effectively returns “counts“ instead of true percentages. See note below for more details.

StateProb(_state_index)

Returns the state probability of the state currently being evaluated.

The _state_index keyword first returns the index for the current state.

StateProb(i; j)

Returns the sum of the state probabilities of the set of states from #i to #j.

StateIndex("state/binding")

Returns the integer index (starting at 1) of the named state, or the state pointed to by the named binding. Usually used in combination with the StateProb() function. Use in combination with the StateProb() function. Useful while building the tree, but changing the order of branches or adding branches may affect states‘ indexes and cause calculation errors.

TransProb()

Returns transition path probability of the current node/branch – i.e., the product of the most recently cached transition probabilities. The product does include the probability stored for the node/branch where the calculation is being called/used. However, note that if branch X's probability is being calculated, then branch X's cached probability from the previous cycle will be used in the product!

PathProb()

Outside of the Markov transition subtree, returns the cumulative path probability for the node being calculated (up to the Markov node in a Markov subtree). Use TransProb() within the Markov subtree.

An argument in StateProb() should correspond to the integer index of a branch of the Markov node (e.g., index=1 for the top state, StateProb(1).

To return the sum of the state probabilities of a range of states, specify the range of branch indexes using two arguments. For example, use StateProb(2;5) to add the state probabilities of states 2 through 5.

Use TransProb() in combination with StateProb() – and perhaps even PathProb() – to determine the percentage of the population/cohort that experience a particular transition at a particular point in time.

If state #n is a tunnel state, StateProb(n) returns the total state probability of all temporary states. StateProb(-x) returns only temporary state x's state probability.

The StateProb() function will work with non-coherent probabilities in a Dynamic Cohort Models.