Plotting divergence

Hi Guys,

Quick and small question: I fitted a model and got a warning saying:

Warning messages:
1: There were 9 transitions after warmup that exceeded the maximum treedepth. Increase max_treedepth above 10. See
https://mc-stan.org/misc/warnings.html#maximum-treedepth-exceeded 
2: Examine the pairs() plot to diagnose sampling problems

Yet when I ran :

library(bayesplot)
mcmc_trace(mymodel, np=nuts_params(mymodel))
mcmc_pairs(mymodel, np=nuts_params(mymodel))

I got no divergence in the plot and instead it said “No divergences to plot”. I should say that sometimes it does plot divergence when I use it this way - so this is confusing.

What am I’m missing here?

Thank you!
Nitzan.

1 Like

Hi,
the “maximum treedepth” errors are different from divergences - some brief description is at Brief Guide to Stan’s Warnings if you want them to be shown in mcmc_pairs, you need to set max_treedepth = 10 when calling it.

Best of luck with your model!

1 Like