The expose_stan_functions function is a great way to use your custom user-defined functions within R. Is there also a way to expose the built-in functions?
I ask because I’m looking to generate random samples from an LKJ correlation distribution, but there aren’t a lot of options in terms of R packages. My workaround is to write a simple wrapper around the function I want in stan and then to expose that:
But if there were a way to just get the original built-in functions with something like expose_builtin_stan_functions('lkj_corr_rng'), that would be super helpful.
I can’t answer the query about exposing built in functions, but for random LKJ samples there is always https://github.com/rmcelreath/rethinking/blob/master/R/distributions.r#L214 (I think the ‘Ben’ mentioned in the comment there is @bgoodri, so I would be surprised if this wasn’t the same way samples were generated in Stan/Math, though it might be a little slower for being done in R).
I’ve had some issues downloading the rethinking package in the past so I was hoping to avoid that option…but I should probably just give it another shot