3
$\begingroup$

Let's imagine that we have created and estimated a posterior with a beta prior and binomial likelihood function. The posterior is given by $p(\mu |D) = Beta(2,99)$. Now, I want to do inference with that model. But the number of trials has changed and I want to know the probability of having 3 success from 40 trials. Can I still use that estimated model, i.e., will just plugging in $\mu$ from $Beta(2,99)$ into $Binom(3|\mu, 40)$ work?

I was looking at a Bernoulli example and there it is clear. We have Bernoulli distribution parameterized as $Bern(x| \mu)$ so just one parameter $\mu$. In the Binomial case it is $Binom(x|\mu, N)$ so N is also playing a role.

$\endgroup$

2 Answers 2

2
$\begingroup$

You observed some Binomial data and ended up with a posterior of $\mathrm{Beta}(2,99)$ for your parameter $\mu$, which I assume is the probability of success.

If you wanted to give a point estimate for $\mu$, you could choose to use the posterior mean, which is $\hat{\mu}=2/(2+99)=0.0198$ (or, alternatively, the posterior median or mode).

You are now going to observe a further 40 trials; let $X$ be the number of successes. You are interested in the probability of observing exactly 3 successes, which is equal to $$ \mathrm{P}(X=3|\mu)={40 \choose 3} \mu^3 (1-\mu)^{40-3} $$ While you could plug your point estimate into the formula, this is not quite right, as it does not take into account the uncertainty around $\mu$.

What you should do is compute $$ \int_0^1 \mathrm{P}(X=3|\mu) f(\mu) d\mu $$ where $f(\mu)$ is your posterior (Beta) density for $\mu$. In other words, you want to integrate $\mu$ out of the joint mass/density of $X$ and $\mu$.

$\endgroup$
4
  • $\begingroup$ Thank you @Doctor Milt. Indeed, I am interested in doing Bayesian inference and I do not want to use point estimates (Maximum a posteriori estimates aka MAP). I found a similart formula (and I understand the logic behind it) to the last one you posted. It is for Bernnoulli case $$ p(x=1|D) = \int_{0}^{1} p(x=1|\mu) p(\mu|D) d\mu = \int_{0}^{1} \mu p( \mu | D) $$. $\endgroup$ Commented Aug 4, 2023 at 9:51
  • $\begingroup$ For Binomial case, I am not sure how to write it down nicely $$ p(x=3|D, 40) = \int_{0}^{1} p(x=3|\mu, 40) p(\mu|D, 101) d\mu $$. This does not feel right since I have the posterior that has a parameter $N$=101 (2success + 99 failures) and the probability that I am trying to estimate is for $N$=40. $\endgroup$ Commented Aug 4, 2023 at 10:00
  • $\begingroup$ (you can ignore $D$ in the formula's above) $\endgroup$ Commented Aug 4, 2023 at 10:18
  • $\begingroup$ Hi @AntonKerel, the fact that your original experiment had 101 trials is already encoded in your posterior distribution for $\mu$. The number of trials in the new experiment ($N=40$) is just a fixed parameter. You know that the conditional distribution for the outcome you care about is $X|\mu \sim \mathrm{Bin}(40, \mu)$, but you want the marginal distribution. To get this, you need to integrate out $\mu$, i.e. average over all possible values of $\mu$ according to your posterior distribution. $\endgroup$ Commented Aug 4, 2023 at 11:10
1
$\begingroup$

Not sure if I follow you, but as I understand your question you observed $k$ successes in $n$ trials and used this data in a beta-binomial model. If your prior was $\mathsf{Beta}(\alpha, \beta)$, then the posterior is $\mathsf{Beta}(\alpha + k, \beta + n-k)$. Now, let's go one step back, your model is

$$\begin{align} \mu &\sim \mathsf{Beta}(\alpha, \beta) \\ X_n &\sim \mathsf{Bin}(\mu, n) \end{align}$$

where $X_n = \sum_{i=1}^n Y_i$ for $Y_i \underset{i.i.d.}{\sim} \mathsf{Bern}(\mu)$. In plain English, you assume that $\mu$ is the probability of "success" for $n$ independent Bernoulli trials. The sum of the ones and zeros from the Bernoulli trials $X_n$ makes a binomial distribution. If now you want to make a guess on the number of successes in $m \ne n$ independent Bernoulli trials, you can just plug in $\mu$ into the binomial distribution $\mathsf{Bin}(\mu, m)$. The trials are identical and independent, so it is like tossing a coin $m$ times instead of $n$, each individual toss behaves the same regardless of how many times you toss.

You can also look at it through the lens of linearity of expectation. The expected value of a single Bernoulli trial is $E[Y_i] = \mu$, for $n$ trials it is $E[nY_i] = n E[Y_i] = n\mu$ and for $m$ trials $m\mu$. Those correspond to the means of the binomial distributions.

So yes, you just plug in the estimated $\mu$.

$\endgroup$
2
  • $\begingroup$ Thank you, Tim. Sorry for a question that is a bit confusing. You almost understood my question. I can rephrase it a bit. I want to produce a (biased) Bayesian esimator of probability of having 3 successes in 40 tosses given the posterior distribution that I have estimated before. In my mind, Bayesian model always produces a probability of some sort. You can then use the pdf of the posterior to do inference. Therefore, I am interested in the probability of success for 40 choose 3 given that my coin priorly has been estimate to follow $Beta(2,99)$. Does this make sense? $\endgroup$ Commented Aug 4, 2023 at 10:17
  • $\begingroup$ @AntonKerel so you want to know what is the probability of seeing 3 successes in 40 trials given that the probability of success is $\mu$ given the posterior beta distribution? This is what I described. $\endgroup$
    – Tim
    Commented Aug 4, 2023 at 10:31

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.