How can I generate Conditional Lognormal distribution

조회 수: 8 (최근 30일)
Vijay
Vijay 2020년 7월 13일
댓글: Vijay 2020년 7월 14일
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.

채택된 답변

Jeff Miller
Jeff Miller 2020년 7월 14일
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);
  댓글 수: 1
Vijay
Vijay 2020년 7월 14일
Thanks Jeff. I realized that the sigma values are too small and corrected to the literature values.
It works.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by