How can I generate Conditional Lognormal distribution
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi Community,
I am trying to create the 10000 sets of random variates of two parameters (a and b) from lognormal distribution with a condition that exp((b-a)/a)*1000 < 5;
a --> mu_a = 0.06, sigma_a = 50;
b --> mu_b = 0.08, sigma_b = 35;
I get to know from documentation for one variable as below but not sure about two varible that follow above condition.
pd = makedist('Lognormal','mu',0.08,'sigma',35);
t = truncate(pd, 0, inf);
r = random(t,10000,1);
Any help would be much appreciated. Thanks in advance.
0 Commenti
Risposta accettata
Jeff Miller
il 14 Lug 2020
Those mu and sigma values don't look right for lognormal distributions. These distributions have only positive values, so they have to be really wildly skewed to have such small means with such large standard deviations. Also, the cutoff of 5 looks too small for these parameters, because a and b will virtually never give a result satisfying the condition. But I think that something like this would work if you adjust the parameters:
mu_a = 0.06; sigma_a = 0.50;
mu_b = 0.08; sigma_b = 0.35;
cutoff = 1020;
nWanted = 10000;
nBatch = 1000;
storedA = [];
storedB = [];
while length(storedA) < nWanted
a = lognrnd(mu_a,sigma_a,nBatch,1);
b = lognrnd(mu_b,sigma_b,nBatch,1);
y = exp((b-a)./a)*1000;
keep = y < cutoff;
storedA = [storedA; a(keep)];
storedB = [storedB; b(keep)];
mean(keep)
end
storedA = storedA(1:nWanted);
storedB = storedB(1:nWanted);
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!