Dear stan community. I would appreciate any help to solve the problem that is causing the error below detailed in my stan model:
#error
SAMPLING FOR MODEL ‘m’ NOW (CHAIN 1).
Chain 1: Rejecting initial value:
Chain 1: Error evaluating the log probability at the initial value.
Chain 1: Exception: binomial_lpmf: Probability parameter is 1.59857, but must be in the interval [0, 1] (in ‘model41bc3e0d5412_m’ at line 33)
#line 33
ncases ~ binomial(nn, pp_hat);
#model
data{
int N;
int ncases[N];
int A[N];
int B[N];
int nn[N];
}
parameters {
real alpha_0;
real alpha_1;
real alpha_2;
real alpha_3;
}
transformed parameters {
vector[N] pp_hat;
for (i in 1:N) {
pp_hat[i] = exp(alpha_0) * (1 + alpha_1*A[i] + alpha_2*B[i] + alpha_3*A[i]*B[i]);
}
}
model {
alpha_0 ~ normal(0, 5);
alpha_1 ~ normal(0, 5);
alpha_2 ~ normal(0, 5);
alpha_3 ~ normal(0, 5);
ncases ~ binomial(nn, pp_hat);
}
I am not certain how to apply the ideas discussed here in my case in particular. Thank you in advance for any help.