Visual illustration of log_prob and adjust_transform

Every now and then there is discussion of what adjust_transform option in log_prob does and how target in MCMC and optimizing differ. The Stan documentation says the technically correct thing and there have been good additional explanations before, but it can be difficult to remember what it means specifically in the interfaces. I like visualizations so I made a visual illustration that specifically uses Stan’s log_prob with adjust_transform=FALSE and adjust_transform=TRUE to help one discussion I was involved (and then decided to spend 5x time to clean it). The notebook ends with illustration of Laplace approximation because there it is crucial whether the mode with adjust_transform=FALSE or adjust_transform=TRUE is used (but this is not to advocate more use of modal normal approximation (aka Laplace) as it will be good only in special cases).


Very nice summary Aki!