data {

int N;// number of observations

int n[N];//trials

int y[N];//successes

int M;

matrix[N,M] x;//predictor matrix

}

parameters {

vector[M] Beta;

real sigma;//between-observation variance

real gamma[N];//random effect

}

transformed parameters {

vector[N] mu;// probability

for (i in 1:N) {

mu[i] =inv_logit(dot_product(x[i],Beta)+gamma[i]);

}

}

model {

Beta~normal(0,1000);//priors are vague

sigma ~ inv_gamma(0.001,0.001);

gamma~normal(0,sigma);

y~binomial(n,mu);

}

Hello everyone!

I would like to calculate mu for a new observation.

I just tried to add predictors x of a new data and calculate it in generated quantities part, however, it takes long time if every time I will run the program.

Is there any way to calculate it using posterior draws?!

Thanks in advance