On Jul 28, 2014, at 3:38 PM, Allen Riddell <
a...@ariddell.org> wrote:
> Hi stan-dev,
>
> I feel like this model definitely shouldn't compile -- but it does. I've got
> a statement:
>
> target ~ categorical_logit(x_beta[i]); // note lack of [i] on LHS
>
> where
>
> int<lower=1, upper=K> target[N];
> vector[K] x_beta[N];
>
> Is this a bug or am I missing something?
The declaration of categorical_logit_log is
real categorical_logit_log(ints, vector);
where ints can be either an int or an array of int.
That is, it's vectorized. It just adds the log prob for each
of the entries. And is MUCH more efficient because the
equivalent log softmax only needs to be computed once.
There's a description of how vectorization work and the notation
for it at the start of the part of the manual on distributions.
But nobody ever finds it, because it's in the middle of what
looks like a plain old list of functions.
- Bob