Troubleshooting a Markov model in TreeAge Pro

When troubleshooting a TreeAge Markov model, how do users isolate and dump variable calculations at specific points in the Markov tree at specific _stages? The same question applies to TreeAge microsimulation models.

0

Comments

1 comment
  • There are a whole bunch of new time reporting features in TreeAge. You turn them on in Tree Preferences -> Analysis Settings -> Time Reporting Selection. Once the Markov process finishes you can view the various reports under Data ->Time Reports in the output selection on the right of the results window.

    For microsim, If I want complete, manual, control over the internal model variables that are captured - I use the globaln() function which writes or retrieves values from global matrices - think of the latter as two-dimensional tracker variables. To write to a global matrix - the syntax is globaln(n; row; col; value) where n is the number of the global matrix that you want to write to. To retrieve values the syntax is globaln(n; row; col). 

    Let's say I want to capture the values of 4 variables on each cycle: var1, var2, var3, var4 - these could represent the values of either regular variables or trackers, I create a variable at the root called aaaGlobalWrite which is defined as globaln(1;_stage+1;1;var1) +...+  globaln(1;_stage+1;4;var4). I then add aaaGlobalWrite to the incremental utility box(es) for the state(s) where it would be relevant to capture values of the variables. For example, if the incremental utility for the 'Well' state is uWell, then the expression would be uWell + (0*aaaGlobalWrite). The latter will ensure that values are written to global matrix number 1 on every cycle. The row number has to be _stage+1 because there is a _stage = 0 but there is no 0 row in the global matrices. I multiply aaaGlobalWrite by 0 because globaln(n; r; c; varX) actually returns the value of varX but I wouldn't want that to be added to the incremental utility for the state.

    Then I create a special variable _post_analysis at the root. The latter instructs TreeAge to do something when the analysis finishes. I define that value as globaln(1;1). The latter tells TreeAge to dump the contents of global matrix 1 to a text file in the same folder as the tree file with the name NameOfTree_globals_1.txt. If there are multiple global matrices to dump then define _post_analysis as globaln(1;1) + globaln(2;2) + ....+ globaln(n;n). You'll then get n text files: NameOfTree_globals_1.txt,...,NameOfTree_globals_n.txt

    Then I run 1 microsimulation trial and then import the text file(s) into Excel for examination. Graphing, etc. I think this is a valuable way to prove the validity of your model by demonstrating that internal calculations are working as expected.

    You can also write to global matrices with one row per microsim trial by using the _trial keyword or with one row per parameter sample using the _sample keyword.

     

    0
    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post