tagging parts of the model for slice sampling of discrete parameters

53 views
Skip to first unread message

Andrew Gelman

unread,
Jun 29, 2014, 5:03:44 PM6/29/14
to stan...@googlegroups.com
[moved to stan-dev]

>> From Andrew:
>> P.S. Just a reminder: one thing we’ve been talking about from time to time is if we want to add slice sampling for discrete variables, we will need to label the appropriate terms of the log posterior. I’m not quite sure how we’re planning to do this (one option that we discussed is to just require duplicate code, which is ugly but could get us started. No rush on this, I just wanted to throw it into the mix in case any of you feel it would affect our current programming decisions.

On Jun 29, 2014, at 10:51 PM, Bob Carpenter <ca...@alias-i.com> wrote:

> I don't see how to block out the log probability function
> for discrete sampling -- it's not even a hierarchy as
> different statements (and I mean statements literally as
> in programming language statement) would need to go in multiple
> cross-cutting blocks.

I agree. It seems that we’d need to do some tagging for each discrete parameter in the model, unless we can get working my pet idea of querying the Stan program to figure out, for each discrete parameter, which computations in the program don’t depend on that parameter and thus don’t need to be recomputed or included in the gradient computation in each step. This perhaps is related to that other idea that Ben was discussing of caching the constant terms in the probability densities so we can include the full densities (which I think will be important for many purposes) without adding much to computation time.



Andrew Gelman

unread,
Jul 2, 2014, 4:56:58 PM7/2/14
to stan...@googlegroups.com
[conversation moved to stan-dev]
We don’t have to do the summation part; for Gibbs/slice it is enough to compute the unnormalized densities.  One way to do this in practice is simply to duplicate some code and require the user to specify the relevant parts of the density for each of the discrete parts of the model.  Another way, which could work in many examples, would be to define different blocks within the model and have the user tell Stan (or for Stan to figure out) which blocks to calculate for which parameters.
This sort of thing might sound onerous but it could work, especially now that we have functions in Stan.
Bugs can do it in complete generality but it might well be that we could do it in most or almost all the cases that people would want to do—and when people want to do it in a really hard problem, it would just require tons of coding for them and they’d see the problem.
On Jul 2, 2014, at 10:49 PM, Michael Betancourt <betan...@gmail.com> wrote:


On Jun 29, 2014, at 7:49 PM, Andrew Gelman <gel...@stat.columbia.edu> wrote:

Just a reminder:  one thing we’ve been talking about from time to time is if we want to add slice sampling for discrete variables, we will need to label the appropriate terms of the log posterior.  I’m not quite sure how we’re planning to do this (one option that we discussed is to just require duplicate code, which is ugly but could get us started.  No rush on this, I just wanted to throw it into the mix in case any of you feel it would affect our current programming decisions.

This is a fundamentally different problem.  Formally we need to compute the condition distribution of the discrete variables given the continuous parameters and vice-versa. 

Say we have discrete variables I and continuous variables X.  Ignoring the conditioning on the data, Stan defines a joint distribution, p(X, I), and we would need to be able to compute

p(X | I ) = p(X, I) / sum_{I} p (X, I)
p(I | X) = p(X, I) / int_{I} p(X, I)

which is just not going to be feasible in practice.

BUGS/JAGS gets around this because the BUGS language is limited to graphical models where the above calculations simplify dramatically (i.e. the Markov blanket is easy to compute from the conditional independence structure).



Michael Betancourt

unread,
Jul 2, 2014, 5:01:27 PM7/2/14
to stan...@googlegroups.com

We don’t have to do the summation part; for Gibbs/slice it is enough to compute the unnormalized densities

But in general the summations bring in nontrivial I and X dependencies and cannot be ignored, even if 
we need only the unnormalized densities.

Andrew Gelman

unread,
Jul 2, 2014, 5:05:10 PM7/2/14
to stan...@googlegroups.com
Yes, but I think this would pop out automatically in the computations.
--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages