There are new features available (as at January 2018) in 2018 R1 to easily select variables, distributions and trackers and see their calculations. Check out the Help files in the software, section 47.1.
There are a few ways you can debug your model. Generally debugging can be done on a couple of levels: one is checking the calculations are being done correctly and other is considering whether the model is representative of what you are trying to model. We can provide some suggestions about how to check calculations in the model using some inbuilt functions and other tools.
Globally for your whole model you can turn on Internal Calculations.
Open Tree Preferences > Analysis Settings > Debugging/Calculations Trace
Check the Internal Calculations box to show all internal calculations in the Console Windoow.
The Calculation Trace Console (where all the output will go) can be found in the Console View which is usually on the right-hand side of the screen.
The limitation of this method is that “all” internal calculations maybe too large to review. Remember to turn this off when you have finished too!
You can use specific built-in functions in TreeAge Pro to turn on and off the calculations you send to the console. Functions such as DebugOn() and DebugOff() allow you to turn on and off internal calculations for some or all of your model. DebugWrite() allows you to The Debug functions have no value so can be placed anywhere in the model without impacting calculations.
For example, if we have a variable called My_Var which we wanted to debug, we could create the following variable to use in the model:
Then using My_Var_debug instead of My_Var to give details of the variable's value and other important information in your model.
Finally, a very specific debug command which you can use anywhere is DebugWriteForce(text) which works whether or not Debug is turned on or off.
For example, create the variable debugStatus (in the Variable Properties View) and place the new variable in the model to get information about which Trial, which Strategy and which Stage we are on:
This variable can be tailored to your model and used wherever details of your model need to be checked.
Time Reporting (see Help section 38.6 in TP2017) allows you to record data updates during Microsimulation, then generate reports from the time-based data.
For Markov Models, the Extended Markov Cohort Report (see Help section 35.4 in TP2017) allows you to follow the cohort through the model and all the calculations across all payoffs.
We would love to hear any other suggestions or techniques people use.
Comments
There are new features available (as at January 2018) in 2018 R1 to easily select variables, distributions and trackers and see their calculations. Check out the Help files in the software, section 47.1.
There are a few ways you can debug your model. Generally debugging can be done on a couple of levels: one is checking the calculations are being done correctly and other is considering whether the model is representative of what you are trying to model. We can provide some suggestions about how to check calculations in the model using some inbuilt functions and other tools.
Open Tree Preferences > Analysis Settings > Debugging/Calculations Trace
Check the Internal Calculations box to show all internal calculations in the Console Windoow.
The Calculation Trace Console (where all the output will go) can be found in the Console View which is usually on the right-hand side of the screen.
The limitation of this method is that “all” internal calculations maybe too large to review. Remember to turn this off when you have finished too!
For example, if we have a variable called My_Var which we wanted to debug, we could create the following variable to use in the model:
My_Var_debug =
debugon() +
DebugWrite("_trial = " + Str(_trial)) + DebugWrite("_strategy = " + Str(_strategy)) + DebugWrite("_time = " + Str(_time)) + My_Var +
debugoff()
Then using My_Var_debug instead of My_Var to give details of the variable's value and other important information in your model.
For example, create the variable debugStatus (in the Variable Properties View) and place the new variable in the model to get information about which Trial, which Strategy and which Stage we are on:
debugStatus = DebugWriteForce("Trial " + Str(_trial) + ", Strategy " + Str(_strategy) + ", _stage " + Str(_stage))
This variable can be tailored to your model and used wherever details of your model need to be checked.
We would love to hear any other suggestions or techniques people use.
Please sign in to leave a comment.