@seantalts @Matthijs @enetsee @rybern (not sure who to tag specifically!) With the current/old stanc
the following Stan program won’t have any issues (until runtime) even though a human can see that the bounds on y
are incompatible with the bernoulli distribution used in the model block:
data {
int N;
int<lower=2,upper=3> y[N];
}
parameters {
real<lower=0,upper=1> theta;
}
model {
y ~ bernoulli(theta);
}
At runtime we get:
Chain 1: Rejecting initial value:
Chain 1: Error evaluating the log probability at the initial value.
Chain 1: Exception: bernoulli_lpmf: n[1] is 2, but must be in the interval [0, 1]
I’m curious if it would be possible for stanc3
to identify that the constraints on y
in the data block (lower=2,upper=3) make it incompatible with the bernoulli distribution (which requires 0/1 values) before runtime? This isn’t the biggest deal, but would be nice. (Sorry if this had already been discussed somewhere I missed)
Edit: I meant to say that this occurred to me because of the problem reported by @erfpak7 in Initialization failed in Pystan