-
Notifications
You must be signed in to change notification settings - Fork 83
Things you should NOT do in TMB
Josh Pritsker edited this page Jul 31, 2020
·
7 revisions
- Do not use
if(x)
ifx
is aPARAMETER
, or is derived from a parameter. TMB will remove the whole if-statement and hence produce surprising results. As an alternative, you can use CondExp statements. However, this can easily create a non-differentiable likelihood, so make sure you know what you are doing (i.e., check the differentiably of ahead of time). (See: this thread and this comment) - Do not attempt to weight the loglikelihood within the C++ code (See: here). This results in a non-normal latent distribution, decreasing the accuracy of the Laplace approximation.