Markov Cohort Trace from Microsimulation

When a model requires Microsimulation, Markov Cohort Analysis should be avoided as it will ignore the elements that required Microsimulation (like individual-level distributions and trackers). If you need the information tracking the movement of your trials among health states, you can generate this information using the Global Matrix and Excel.

IMPORTANT: TreeAge Pro 2016 R1.0 introduced Time Reporting for Microsimulation which automatically generates patients movement through a model. Review Time Reporting in the Help files for more details. The Markov Cohort Trace method described here is unlikely to be required if you are using 2016 or after version.

Model File

  • There is a model attached to this article that is used to demonstrate this technique.
  • There is also an Excel file for parsing the data output from the model.

Global Matrix Function

  • At the Local Cancer state, the following command is used to store the current state for that trial.
    • t_global=GlobalN( strategy; _trial; _stage+1; 1)
      • matrix = strategy, which is a variable which is set differently for each treatment strategy. That allows each strategy's data to be stored in a different matrix.
      • row = _trial, which stores the data for each trial in a different row.
      • col = _stage+1, which stores each cycle's data in a different column.
      • value = 1, for the top state (Local Cancer).
  • At the Metastases state, the same command is used except...
    • value = 2, for the Metastases state.
  • At the Dead state, there are no global commands because tracker modifications are not executed on an absorbing state.
  • At each transition to dead state from the Local Cancer state and Metastases state, a similar command is used.
    • GlobalN( strategy; _trial; _stage+2; 3)
      • matrix - same as above.
      • row - same as above.
      • col = _stage + 2, which stores the death in the next cycle (not the current cycle).
      • value = 3 or 4 for deaths from Local Cancer and from Metastases respectively.
  • At the root node, the variable definition _post_analysis = GlobalN(1;1)+GlobalN(2;2) exports the global matrix data to a text file immediately after analysis finishes.

Excel Processing of the Global Matrix Output

  • The data exported will be a text file with each trial presented by row and each cycle presented by column. A little manipulation in Excel will give you the percentage of trials in each state in each cycle.
  • The attached Excel worksheet contains the formulas you need for the calculations.
    • Add a column to the left of the data.
    • Enter the state numbers in the new column but below the existing data.
    • Use the CountIf function (see worksheet for details) to determine the number of trials in each state (1=Local Cancer, 2=Metastases, 3=Died from Local Cancer, 4=Died from Metastases) by cycle.
      • Note that if you sum the four states at this point, you will not get back to the total number of trials once trials begin to die. That is because the death is reported only once. We will take care of that in the next steps.
    • Create a new set of data rows with the proper health states.
      • Local Cancer refers to the row for state 1.
      • Metastases refers to the row for state 2.
      • Dead refers to the sum of the rows for state 3 and state 4.
      • After the first cycle, add the prior deaths to the new deaths.
      • Correct the last cycle for the non-dead states.
        • Set equal to the trials from the last cycle less the trials that died in the last cycle from that state.
      • Add a sum for the reformulated health states to ensure that every column sums to the total number of trials.


Once you complete those updates, you will have the percentage of trials in each state by cycle. This data can be used to create a graph similar to the StateProb and Survival Curves generated by Markov Cohort Analysis.

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request



Article is closed for comments.