Hello everyone,
The following Stan program:
generated quantities {
vector[3] theta = [0, 0.5, 0.5]';
vector[3] log_theta = log(theta);
int test = categorical_rng(theta); // works
int test2 = categorical_rng(exp(log_theta - log_sum_exp(log_theta))); // works
int test3 = categorical_logit_rng(log_theta); // doesn't work
}
yields this error:
categorical_logit_rng: Log odds parameter[1] is -inf, but must be finite!
Given that exponentiating the normalised log probabilities works for categorical_rng
, I think this is a bug. Please let me know if I'm wrong.
Thanks,
Matt