Bernoulli_logit_rng not vectorized in RStan 2.18.2?

I’m trying to use bernoulli_logit_rng in a vectorized manner, as it appears in the docs.

generated quantities{
  int fake_dat[N] = bernoulli_logit_rng(T);
}

Where T is a vector.

However, I’m getting the following error:

Unknown variable: to_vector
No matches for: 

  bernoulli_logit_rng(vector)

Available argument signatures for bernoulli_logit_rng:

  bernoulli_logit_rng(real)

So I’m resulting to a for loop for my model, but there is a discrepancy I think between the docs and Stan.

Using RStan 2.18.2

Any chance this works in 2.19? The code is there in Github to make this happen.

I updated my RStan installation to 2.19.2, and it works.

(BTW, had to manually remove “StanHeaders”, just removing RStan and reinstalling it resulted in an error when loading the package).

2 Likes