# Calculating the new beta parameters given two variables

5 views (last 30 days)

Show older comments

Lewis Waswa
on 4 Jan 2023

Commented: John D'Errico
on 5 Jan 2023

##### 5 Comments

John D'Errico
on 5 Jan 2023

Edited: John D'Errico
on 5 Jan 2023

@the cyclist - some people extend the beta to live on different support, instead of [0,1] or [-1,1]. That can result in either a 3 or 4 parameter beta, depending on the bounds chosen. It is just a shift and/or a scale though, nothing more in that.

As I said, there is no named distribution that represents the sum of two beta random variables. Wanting one will not make it appear.

Alternatively, if you like, there IS a distribution, but it requires 4 parameters (not to mention the support) to represent that distribution. They are the original beta parameters of each of the parents. But that is essentially what I suggested in my answer. If you want to find the sum of two betas, then just start by sampling the two betas, then add them together. Anything else you would do would only be an approximation, and that approximation would often be a terribly poor one. Whereas, my suggestion is in fact the exactly correct distribution, because there are no approximations needed.

### Accepted Answer

John D'Errico
on 5 Jan 2023

Edited: John D'Errico
on 5 Jan 2023

I saw this question when you first posted, but it was not at all clear what was your question. Now I see you want to compute the distribution of the sum of two beta random variables, as a function of their parameters. This is of course a trivial thing to do for Normally distributed random variates, but far less so when the variables are not one of the easy to deal with distributions. And a beta distribution can be pretty nasty, since some sets of parameters will yield a bimodal distribution. You can do some reading online, but I think you will not find any simple analytical result.

In fact, you MIGHT try to claim that the sum should be another beta distriibution, but that is clearly false. (It MIGHT not be a terribly bad approximation for some sets of parameters, when both of the parents are simple unimodal forms. Remember that the support of the distribution will change, but that is just a scaling thing.) But consider the case where each beta distribution has alpha=beta=1. (This is the case where a beta RV reduces to a uniform distribution.) But the sum of two uniform random variables has a triangular distribution. And there is no set of beta parameters that represents a triangular distribution. So it MUST fail, if you think the sum might also be another beta random variable.

And you might decide to try using various statistical tolerancing techniques to compute the distribution of the sum. You could use the Pearson or Johnson family, then to generate the result. But those distributions pretty much all have infinite support as I recall. ANd while that would not be terrible for some sets of parameters, again, there are a wide variety of shapes you can start with for each of the beta parents, and the sum will not fit into any simple distribution in general.

If your goal is simply to generate a random variable that is the sum of two beta random variables however, then surely this is trivial. There is no need to compute new beta parameters. Just use the parent beta parameters, and make two calls to betarnd. What could be easier? The nice thing is, this will have EXACTLY the correct distribution, even though you need not have even a clue as to the true distribution. In the end, I think you are looking for a complicated solution to a trivially easy problem.

##### 2 Comments

John D'Errico
on 5 Jan 2023

a1 = 2;b1 = 3;

a2 = 1.5;b2 = 4;

k1 = betarnd(a1,b1,[1,100000]);

k2 = betarnd(a2,b2,[1,100000]);

k3 = k1 + k2;

histogram(k3)

That is all you need to do. As long as you are not talking about a mixture distribution, a subtly different thing. But you have never said anything about mixture distrbutions, just the sum of random variables. (Actually, that is also not difficult to do.) If you just want it in one call, then just do this:

betasumrnd = @(a1,b1,a2,b2,sz) = betarnd(a1,b1,sz) + betarnd(a2,b2,sz);

As I said, just a 4 parameter distribution.

### More Answers (0)

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!