About "simplex" command.-

1,440 views
Skip to first unread message

Freddy Omar López Quintero

unread,
Sep 2, 2013, 3:02:05 PM9/2/13
to stan-...@googlegroups.com
Hello Stan-users,

I'm trying to emulate the section 10.2 from the stan-reference manual (v1.3) but I'm confronting with a doubt and I hope you can help me: What does it mean exactly, in parameters section, simplex[K] theta? How is the distribution of theta? What are they (hyper)parameters? Is theta sampled from a Dirichlet distribution?

Please excuse me for this (perhaps) silly question.

Cheers!

--
«But Gwindor answered: 'The doom lies in yourself, not in your name.'»

JRR Tolkien

Bob Carpenter

unread,
Sep 2, 2013, 3:21:26 PM9/2/13
to stan-...@googlegroups.com
The exact transform used to map (K - 1) unconstrained
variables to a K-simplex is described in the transformations
chapter of the manual.

If you just declare a parameter as a simplex[K], then
its distribution is implicitly uniform over K-simplexes.
So yes, it's Dirichlet(1), where 1 is a unit K-vector, because
that's uniform on simplexes.

The sampling is carried out by adjusting for the Jacobian in the
tranform.

For instance, this model will just sample theta
uniformly at random from the space of valid K-simplexes:

data {
int<lower=2> K;
parameters {
simplex[K] theta;
}
model {
}

You can then add in a prior, which is just multiplied into the
total log probability (the uniform multiplies by a constant, so
has no effect). If you want to put a Dirichlet prior on theta, do
it explicitly in the model, as in:

model {
theta ~ dirichlet(alpha);
}

where alpha is defined to be a non-negative K-vector in the data (or
hierarchically as a parameter).

- Bob
> --
> You received this message because you are subscribed to the Google Groups "stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Freddy Omar López Quintero

unread,
Sep 2, 2013, 9:44:06 PM9/2/13
to stan-...@googlegroups.com
Thanks Bob! Your answer has been very useful.

Cheers!




On 9/2/13 3:02 PM, Freddy Omar López Quintero wrote:
Hello Stan-users,

I'm trying to emulate the section 10.2 from the stan-reference manual (v1.3) but I'm confronting with a doubt and I hope
you can help me: What does it mean exactly, in parameters section, simplex[K] theta? How is the distribution of theta?
What are they (hyper)parameters? Is theta sampled from a Dirichlet distribution?

Please excuse me for this (perhaps) silly question.

Cheers!

--
«But Gwindor answered: 'The doom lies in yourself, not in your name.'»

JRR Tolkien

--
You received this message because you are subscribed to the Google Groups "stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages