# Fitting proportions in a Bayesian model and controlling the error around the value

I am using a Bayesian state space model constructed in the BUGS language to fit my data.

One of the outputs of the "state" part of the model is proportions.

I use a beta distribution in the "observation" part to fit predicted values to observed ones with the following code.

for(i in 1:n) {
y[i] ~ dbeta(alpha[i], beta[i])
alpha[i] <-    mu[i]  * phi
beta[i]  <- (1-mu[i]) * phi
}

In that case, phi is controlling the spread around the mean value, but this "error" is variable when mu is changing. Its value follows a bell curve with highest error occurring at a proportion of 50%.

• Is there a way to fit proportions with a constant error?
• What do you think of the use of a truncated [0,1] normal distribution?
• What kind of error are you talking about? Is it $\sum_{i=1}^n \mu_i - Y$ (posterior probability minus observed multinomial outcome) or $\hat{Y} - Y$ (classification error for ordinal outcomes) or... "error" needs a lot more context than a few lines of bugs. – AdamO Jul 15 '13 at 21:57
• @AdamO Some details ... in my model mu[i] is provided by the state part constituted by a population dynamic model. It represents the proportion of the population in a specific age classe. y[i] is the observation of this proportion from surveys. However, surveys are not perfect and this estimate of the proportion include an error. Now my objective is to be able to introduce this error in my calculation. After further thinking, I think that I have to use a really small phi, but use an error on mu. – Arnaud Jul 18 '13 at 14:18
• Have you considered using a Bayesian mixed effects GLM with logit link and fixed/random effects for $mu$ looking at the exact posterior distribution of the log odds for these data? Oh, and I hope $n$ is very large. – AdamO Jul 18 '13 at 16:16
• @AdamO I am not trying to explain the proportion with some variables, I am fitting prediction data on observation data. So I do not see how I can use a mixed effect model for that ... but I could be wrong. – Arnaud Jul 18 '13 at 17:50
• In fact yes, there are variables, these are the parameters of the population model. – Arnaud Jul 18 '13 at 18:16

With "2" spaces, the beta prior is favorable because it is the conjugate prior for a bernoulli observed random variable. The beta prior is flexible and can appear approximately normal while maintaining the correct support $\Omega = (0, 1)$. With more than two spaces, the analogue is the use of dirichlet distribution for a multinomial outcome. As we know, choosing conjugate priors is not necessary for approximately correct Bayesian inference, but they tend to behave much more regularly in small samples and/or with rare events.