Hello everyone. I am using the rstan to do the fitting, my code is below
stan.fit = stan(file = 'DSP with WL.stan', data = list(n = N, cmatrix = C_Matrix, y = Y), algorithm = "HMC", control = list(adapt_delta = 0.8, max_treedepth = 10), chains = 1,iter = staniter,warmup = stanwarmup,refresh = 1);
In my code, I set algorithm = “HMC”. As I know in the HMC algorithm, the gradient of the log posterior is need, but it didn’t ask me to give the gradient of the log posterior. I want to know did I do it in the wrong way or stan will calculate the gradient automatically?