Parser Warnings for Uniform Priors

34 views
Skip to first unread message

Michael Betancourt

unread,
Oct 29, 2015, 6:25:16 PM10/29/15
to stan development mailing list
Serious proposition — can we have the parser spit out warnings if
there are modeling features we don’t like? inv_gamma(small, small)
might be hard to spot given the different ways a small number can
be defined, but uniform priors are easy. Having any model where
the uniform distribution is used spit out a warning like

“You have used a uniform distribution on a bounded space which
can often lead to misbehaved models. If you encounter fitting
problems check that the parameter <name> has the bounds
(<lower>, <upper>) for example

real<lower = <lower>, upper=<upper> <name>;

But please consider replacing such hard constraints with a
soft constraint, such as

<name> ~ normal((<lower> + <upper>) / 2, (<upper> - <lower>) / 2).”

Daniel Lee

unread,
Oct 29, 2015, 6:31:02 PM10/29/15
to stan-dev mailing list
Is there a good reason for the uniform distribution?


--
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.

Michael Betancourt

unread,
Oct 29, 2015, 6:36:57 PM10/29/15
to stan...@googlegroups.com
It’s used almost exclusively when people want to add
hard constraints to their model (which we discourage)
and almost always do wrong (because they don’t add
the corresponding bounds on the parameters).  Almost
half of the modeling emails this week were about this
and it seems to be growing.

Daniel Lee

unread,
Oct 29, 2015, 6:39:08 PM10/29/15
to stan-dev mailing list
Think someone's teaching a class and suggesting this?

Maybe we need to put it up on the blog.

Bob Carpenter

unread,
Oct 29, 2015, 8:31:46 PM10/29/15
to stan...@googlegroups.com
The inv_gamma(0.001, 0.001) thing comes from the BUGS examples
which tried to use it to approximate flat priors. No idea where
the interval priors are coming from, but I assume the same desire
not to add information to the data.

The uniform() is really just there because it seemed like it
was necessary for completeness. As is, the only possible use for
it is if you need a normalized probability. Otherwise, it's
redundant with the constraint declarations. And it's definitely
bad if you have an unconstrained variable drawn according to
a uniform.

We could try to detect some of these. We have the parse tree for
the Stan program as an abstract syntax tree before we do code
generation. Or we could try to catch it as it happens.

- Bob

Michael Betancourt

unread,
Oct 30, 2015, 7:41:06 AM10/30/15
to stan...@googlegroups.com
Interval priors are coming from people who have been taught
that prior information should be encoded in hard constraints,
i.e. that you choose extreme values and then claim to be
“ignorant” within them. This unfortunately gets taught a lot
in the sciences which is why I think we’re seeing it more and
more.
Reply all
Reply to author
Forward
0 new messages