I’m trying to convert a model into a map_rect function. I receive the following the error when I try to compile the model:
Require real return type for probability functions ending in _log, _lpdf, _lpmf, _lcdf, or _lccdf.
I think the function below I wrote should be returning a real, but it does not appear to be.
functions{
vector bin_log(real beta, real alpha, vector theta, int[]Vs, int[]Is){
real lp = binomial_logit_lpmf(Vs | Is, beta + alpha * theta);
return [lp]';
}
}
orignal model block
model{
theta ~ normal(0, 1);
alpha ~ lognormal(1, 1);
beta ~ normal(0, 3);
for(k in 1:p){
V[,k] ~ binomial_logit(I, beta[k] + alpha[k] * theta); //model
}
}