This is slowly getting a bit out of my depth. I am quite sure this is not possible in GQ. I think that to access the gradient you need to use the diagnostic_file
in rstan
(save_latent_dynamics
in cmdstanr
) or hack around in C++.
1 Like