# A beta distribution multiplied by a constant and a binomial distribution based on it are equal?

To get the number of "positive cases" I'm in doubt between two strategies.

The first one is to draw samples from a Beta distribution: $$p \sim Beta(\alpha + cases, \beta + non\ cases)$$, using these draws to get the number of positive cases given a total: $$n \sim Binomial(p, Total)$$.

The second approach is to multiply the draws from the Beta distribution directly with the total: $$n \sim Beta(\alpha + cases, \beta + non\ cases) \times Total$$.

Theoretically, the first method seems more correct, since you first estimate the parameters from the data, update a prior, and then use the posterior parameters with the appropriate distribution to predict the outcome. The second though is quite computationally faster (I'm using Monte Carlo simulations) then the first and the results don't seem too different.

So I was wondering if the two forms are mathematically equivalent and if not, which are the drawbacks of the second method.

• Note that the second one can generate a fraction, e.g., if $p = 0.1$ and $Total = 19$ then $n = 1.9$, but the first one can't. Therefore, they can't be mathematically equivalent. Feb 10, 2020 at 15:42
• On small numbers you're right, but as the denominator of the Binomial goes bigger don't they get similar? Feb 10, 2020 at 18:25
• Well the question was "mathematically equivalent", which they aren't. The second method doesn't give you the same amount of variability in the result that the first one does, either, since in effect it assumes your Binomial variate generated exactly $np$ successes, which it typically won't. Feb 10, 2020 at 18:57
• Could you elaborate more on this in an answer? Feb 10, 2020 at 18:58

Let $$P \sim \mathcal{Beta}(\alpha+C, \beta + NC)$$ and then $$N_1 \mid P=p \sim \mathcal{Binom}(T,p)$$ and alternatively $$N_2 =T \cdot p \quad \text{Given that P=p}.$$ $$N_1$$ and $$N_2$$ have the same expectation (use the law of total expectation), but they do not have the same variance: $$\DeclareMathOperator{\E}{\mathbb{E}} \DeclareMathOperator{\V}{\mathbb{V}} \V N_1 = \E \V N_1 \mid P + \V \E N_1 \mid P = \\ \E T P (1-P) + \V T P = T \E P(1-P) + T^2 \V P$$ while $$\V N_2 = \E \V N_2 \mid P + \V \E N_2 \mid P = \\ \E T^2 \cdot\underbrace{ \V P\mid P }_0 + \V T \cdot \E P = 0 + T^2 \V P$$ and now you can finish the calculation by using the expectation and variance of the beta distributed $$P$$. It is immediate from the above formulas that $$N_1$$ has the larger variance, as is expected from the hierarchical sampling.
• One question. Does this elaboration take into account that the model is hierarchical? that is the parameters of the Beta are fixed, but the p in the binomial is a random variable produced by the previous Beta. Wouldn't $N_1$ have variance components coming from the Beta and the Binomial, and therefore higher than just the Beta? (feel free to destroy me on this) Mar 10, 2020 at 12:10
• My argument is hierarchical, with two levels corresponding to the two levels in the total variance formula, that is $\DeclareMathOperator{\E}{\mathbb{E}} \DeclareMathOperator{\V}{\mathbb{V}} \E \V$ and $\V \E$. But my algebra was wrong ... will correct now! Mar 11, 2020 at 23:45
• Because, given $P$ it is a constant ... so zero variance. Mar 12, 2020 at 8:52