support of categorical distribution

5 views
Skip to first unread message

Jiqiang Guo

unread,
Feb 20, 2012, 2:54:45 PM2/20/12
to stan development mailing list
In Bugs example vol1/inhalers, the response is modeled as
categorical distribution, i.e.,
y ~ categorical(p).

Currently if p is of length N, the support for y is {0, 1, ..., N-1}.
In Bugs/JAGS, it is {1, 2, ..., N}.
Should we follow Bugs/JAGS convention?

Now using the exact data from Bugs example, I am using
y - 1 ~ categorical(p)

--
JIqiang

Bob Carpenter

unread,
Feb 20, 2012, 4:47:45 PM2/20/12
to stan...@googlegroups.com

On 2/20/12 2:54 PM, Jiqiang Guo wrote:
> In Bugs example vol1/inhalers, the response is modeled as
> categorical distribution, i.e.,
> y ~ categorical(p).
>
> Currently if p is of length N, the support for y is {0, 1, ..., N-1}.
> In Bugs/JAGS, it is {1, 2, ..., N}.
> Should we follow Bugs/JAGS convention?

We followed the conventions in BDA (which match
the Wikipedia in this case).

It seems to make more sense to use 1...N
rather than 0...(N-1) because we index from 1
and then the categorical will match the multinomial.

But then the Bernoulli uses 0 and 1. Can't tell
what BDA would do for that because it only has
the binomial.

What does everyone else think?

If we follow BDA, we need to doc this in a section
BUGS/JAGS vs. Stan conventions.

> Now using the exact data from Bugs example, I am using
> y - 1 ~ categorical(p)

That should work for now (and in the future if we stick
with the BDA convention).

- Bob

Andrew Gelman

unread,
Feb 20, 2012, 4:57:31 PM2/20/12
to stan...@googlegroups.com
We can also change any notation in BDA if you'd like---as you know, I'm working on the 3rd edition right now!
A

Ben Goodrich

unread,
Feb 20, 2012, 5:25:23 PM2/20/12
to stan development mailing list
On Feb 20, 4:47 pm, Bob Carpenter <c...@alias-i.com> wrote:
> It seems to make more sense to use 1...N
> rather than 0...(N-1) because we index from 1
> and then the categorical will match the multinomial.
>
> But then the Bernoulli uses 0 and 1.  Can't tell
> what BDA would do for that because it only has
> the binomial.
>
> What does everyone else think?

Put me down for using zero iff the outcome variable can be analyzed as
ratio-scale. Sometimes ratio-scale kind of makes sense for binary
variables, but it's hard to come up with an example where it makes
sense with more than two categories.
Reply all
Reply to author
Forward
0 new messages