On 7/31/12 4:33 PM, Andrew Gelman wrote:
> Hi, Bob. I'm writing some stuff in BDA3 on Stan and in preparation am reading the manual. I have some questions:
>
> 1. Why do we need bounds in a data statement (for example, int(0,) N;)? Data are just data, so what is the point of the bounds? Is it for later, when we want to do "forward simulation" for posterior predictive checking and debugging?
They're optional. There are two points. One is to declare
the intent of the model so that it's easier to read and
understand. Two is to catch errors as early as possible.
> 2. In math notation, (a,b) is an open interval, i.e. it can't equal a or b.
> In the manual, you define bounds as closed (e.g., real(0,1) takes on continuous
> values between 0 and 1 inclusive). I have 2 questions. (a) could we
> use [] notation for inclusive because that would be consistent with math,
> or is that just too messy for parsing?
Changing Stan to use () instead of [] is no problem.
It'll require changing every single model and the
doc. The models we can probably change pretty
automatically and the doc semi-automatically.
The reason it was originally (a,b) was because it's
theoretically open. For example, in math, exp
maps (-inf,inf) to (0,inf), both exclusive.
In IEEE arithmetic, you get underflow so that
any number less than -800 or so maps to 0 and
any number greater than 800 goes to infinity (it's
actually a value in IEEE arithmetic).
> (b) I think that for continuous models with
> bounds, we _don't_ want the bounds to be included.
That's a bit trickier. See above. We'd have to
somehow bound everything away from 0 and +inf.
> Thus the notation only
> arises for discrete random variables. (And I agree that it would be awkward
> to use "int(-1,2)" to indicate a 0/1 binary variable.)
Yeah, we don't want int(-1,2), int[0,1] would be better.
> I'm sure I'll have more questions to come�
Bring 'em on!
- Bob