Folder directory of NUTS

Hi all,

Could anyone kindly let me know where the source codes of NUTS are stored for Stan? I found some folders in Github for C++ and MatLab. However, I am not sure which folders are the “offiical” ones for the Rstan package.

I am trying to figure out the details of the algorithm NUTS in the codes. Thank you for your help in advance.


I am not sure which folders are the “offiical” ones for the Rstan package.

all Stan interfaces use the core Stan services which are written in C++.

I suggest that instead of looking at the source code, you read the NUTS algorithm paper:

and Michael Betancourt’s very beautiful introduction to HMC:
note that the latter ends with this:

Although Stan (Stan Development Team, 2017) was first developed around this original No-U-Turn sampler, more recent releases have adopted some modifications. In addition to the generalized No-U-Turn termination criterion, the Hamiltonian Monte Carlo implemen- tation in Stan uses multinomial sampling from each trajectory instead of slice sampling, which provides a significant improvement in overall performance.


Hi Mitzi,

Thank you for your clarification. I will read both of them in details. I read the first paper before but not the second one. There are so many small C++ codes for NUTS in Github, including NUTS, NUTS_classic, etc. I was a little bit lost. Your explanations help to explain them now.