stan icon indicating copy to clipboard operation
stan copied to clipboard

*_rng() functions that match all existing signatures available for corresponding *_lpdf() functions

Open mike-lawrence opened this issue 2 years ago • 1 comments

At present, most *_rng() functions for quantities have a single signature, requiring loops to accommodate expressions that are otherwise expressable with a single line when using the corresponding *_lpdf() in the model block. What would it take to get equivalence in available signatures between *_lpdf() and corresponding *_rng() functions? Happy to help, but wouldn't know where to start!

mike-lawrence avatar Apr 30 '23 18:04 mike-lawrence

I think the primary work for this issue would be in the math library.

Based on the compiler, here are a list of distributions for which I believe the RNG and density signatures do match:

Details

 beta
 beta_binomial
 bernoulli
 bernoulli_logit
 binomial
 cauchy
 chi_square
 discrete_range
 double_exponential
 exp_mod_normal
 exponential
 frechet
 gamma
 gumbel
 hypergeometric
 inv_chi_square
 inv_gamma
 logistic
 loglogistic
 lognormal
 neg_binomial
 neg_binomial_2
 neg_binomial_2_log
 normal
 pareto
 pareto_type_2
 poisson
 poisson_log
 rayleigh
 scaled_inv_chi_square
 skew_double_exponential
 skew_normal
 student_t
 std_normal
 uniform
 von_mises
 weibull

There is one _rng function with no corresponding density:

hmm_latent

And the following densities have incomplete RNG signatures (usually missing vectorization):

beta_proportion
bernoulli_logit_glm
categorical
categorical_logit
dirichlet
inv_wishart_cholesky
inv_wishart
lkj_corr
lkj_corr_cholesky
multinomial
multinomial_logit
multi_normal
multi_normal_cholesky
multi_student_t
multi_student_t_cholesky
ordered_logistic
ordered_probit
wishart_cholesky
wishart_rng

And finally, missing RNG functions entirely:

binomial_logit
categorical_logit_glm
gaussian_dlm_obs
lkj_cov
multi_gp
multi_gp_cholesky
multi_normal_prec
neg_binomial_2_log_glm
normal_id_glm
ordered_logistic_glm
poisson_log_glm
wiener

For any given distribution above it would be pretty easy to have the compiler spit out the signatures which are still needed.

WardBrian avatar May 08 '23 20:05 WardBrian