Calculating the new beta parameters given two variables

15 vues (au cours des 30 derniers jours)
Lewis Waswa
Lewis Waswa le 4 Jan 2023
Commenté : John D'Errico le 5 Jan 2023
I have two beta distributed random variables with parameters, mu1, alpha1 and beta1 and mu2, alpha2, beta2 for variables A and B. I would like to generate random variable C witth parameters mu3, alpha 3, and beta 3 to use in another computation. How can I go about tthis?
  5 commentaires
Lewis Waswa
Lewis Waswa le 5 Jan 2023
Modifié(e) : Lewis Waswa le 5 Jan 2023
Thank you @the cyclist and @John D'Errico. Please allow me to clarify @the cyclist. I have clarified the first concern using my reply to @Torsten. sorry for not being clear. On tthe second question, thank you for the correction, however I do know that the alpha and beta parameters are used. On the third question, i have the parameters for the two random variables, nott the variables themselves. On the 4th question, I would like to know the parameters of the resulting of the sum of k1 and k2. And k1 and k2 are nott correlated. Lastly, I am trying to calculate the parameters of the third variable.
John D'Errico
John D'Errico le 5 Jan 2023
Modifié(e) : John D'Errico le 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.

Connectez-vous pour commenter.

Réponse acceptée

John D'Errico
John D'Errico le 5 Jan 2023
Modifié(e) : John D'Errico le 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 commentaires
Lewis Waswa
Lewis Waswa le 5 Jan 2023
@John D'Errico. This is insightful. Indeed with a1 and b2, I can generate k1 and the same applies to k2 where I have a2 and b2. But tthen I would be stuck with two variables.
% sample code
k1=betarnd(a1,b1,[400,50])
k2 =betarnd(a2,b2,[400,50])
k3
How do I then obtain the k3, is it a simple sum of the same? If that be the case then I could simply obtain the beta parameters of the resulting sum of k1 and k2.
John D'Errico
John D'Errico le 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.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by