I need to calculate the mean of each state. In R, I did this by using
tapply(y,state,mean)
.
Here is an example:
state <- rbinom(10,4,0.6)
y <- rnorm(10)
tapply(y,x,mean)
where y represent the vector of the fitted values and state represent the dependent variable which is a factor.
I am wondering how I could do this in Winbugs. Any one any idea on that?