I just noticed something funny while running rstan 2.19.2. I have a model that was getting the max treedepth warning, so I ran rstan::sampling(..., control = list(max_treedepth=15)). When the model finished sampling I didn’t get any warning, but when I ran rstan::check_hmc_diagnostics, it once again showed me the treedepth warning. I took a look at the samples csv and it indeed had # max_treedepth=15 in the header, but when I run:
The limit applies to all the iterations, but you do not get warnings for exceeding the max_treedepth during warmup. Nor do you get divergent transition warnings during warmup. Those almost always happen when you move from one window to the next.