How to generate mixture of exponential and beta distribution
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lakshit Chugh
el 3 de Mayo de 2020
Comentada: Jeff Miller
el 4 de Mayo de 2020
Hello
I have to generate random variable from exponential and beta distribution where a=4 b=7 for beta and lamda=0.5 while p=0.8 How can i generate mixture of both?
0 comentarios
Respuesta aceptada
Jeff Miller
el 3 de Mayo de 2020
Check whether I have interpreted your parameters correctly, but it should look something like this:
lambda = 0.5;
a = 4;
b = 7;
pr_exponen = 0.8;
n = 1000;
e = exprnd(1/lambda,n,1);
b = betarnd(a,b,n,1);
u = rand(n,1);
mix = zeros(n,1);
use_e = u < pr_exponen;
mix(use_e) = e(use_e);
mix(~use_e) = b(~use_e);
figure; histogram(mix);
4 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!