I want to run some Bayesian analysis on some data. Suppose we have a sample that we believe comes from a binomial population. We have $m$ observations

$$X_i \sim \text{Bin}(n,p) \quad \quad \quad \text{ for } i \in \{1,2,\dots,m\}.$$

I have chosen my prior to be a beta distribution. I'm unsure how to pick parameters to make my distribution better suited to my beliefs. I assume I would take the sample mean and set the mean of the beta prior equal to this number, but I'm not sure what to do about working out the variance. Can anyone offer a suggestion?

  • $\begingroup$ You can set the mean as the ratio $\alpha/(\alpha+\beta)$, and the distribution has an effective sample size of $\alpha+\beta$ so the smaller they are the less your prior will contribute to the posterior. $\endgroup$
    – PBulls
    Dec 15, 2023 at 18:18
  • 2
    $\begingroup$ You do not set the prior mean to the sample mean but to the mean of your prior belief (the Bayesian updating process handles the sample through the likelihood). You also need some measure of how uncertain your prior belief is and some way of expressing this. $\endgroup$
    – Henry
    Dec 15, 2023 at 21:21
  • $\begingroup$ @Henry What do I do then if I don't have strong beliefs about my data? Why would it be incorrect for me to set the prior mean to be the sample mean? What're the effects of this? $\endgroup$
    – TerryStone
    Dec 16, 2023 at 12:32
  • $\begingroup$ @PBulls What does your comment about the sample size being alpha + beta mean? $\endgroup$
    – TerryStone
    Dec 16, 2023 at 12:33
  • $\begingroup$ @TerryStone such prior carries an effective sample size of $n=\alpha+\beta$. If you have a beta likelihood on 30 observations and a beta prior whose parameters sum to 30 they will contribute equally to the posterior, and e.g. Jeffreys' prior (0.5, 0.5) carries a weight of 1 observation. In the same way a normal conjugate with SD $\sigma/\sqrt n$ carries the weight of $n$ observations from a distribution with SD $\sigma$. The same idea appears in Javier's answer, because for priors it's useful to think in terms of how much your actual data can shift them (how their 'sample sizes' relate). $\endgroup$
    – PBulls
    Dec 16, 2023 at 15:38

1 Answer 1


You could try to set a Beta prior distribution on $p$ and parametrize it in terms of the prior mean $\mu_p$ and prior precision $\varphi_p$. If $(a_1, a_2)$ are the canonical shape parameters of the Beta distribution, then $\mu_{p}= \frac{a_1}{a_1+a_2}, \varphi_{p}= a_1+ a_2$. This might be more intuitive for you. I have uploaded a plot that shows the beta distribution under the mean-precision parametrisation for several choices of $\mu_{p},\varphi_{p}$. The plot displays the beta distribution under the mean-precision parametrisation for several choices of the prior mean and precision.

  • 1
    $\begingroup$ Because the question asks specifically about variance, some explanation of your "precision" would help here, because it's not equal to the usual meaning of "precision" (as the reciprocal variance). That would be $(a_1+a_2)^2(1+a_1+a_2)/(a_1a_2).$ For specifying parameters for an intended mean and variance, see the answers at stats.stackexchange.com/questions/12232. A comment in that thread explains $\phi_p.$ $\endgroup$
    – whuber
    Dec 15, 2023 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.