How to code expressions involving integral of lognormal and uniform distributions?
7 views (last 30 days)
Show older comments
I am coding some equations which involve lognormal and uniform variables. For instance, I have the following expression (let's call it first expression):
and then another expression (let's call this one second expression):
You will notice expression (2) is just expression (1) under double integral. Here, and are log-normally distributed, that is and , respectively. Further, follows a uniform distribution, i.e., and (it's a product of the two lognormal variables). In the second expression, the first expression is first integrated with respect to which follows a uniform distribution and then it's integrated a second time with respect to z which follows a lognormal distribution.
I am struggling to figure out how to code them correctly. I will be most grateful for any help. Can I code them like this?
SB = (1 - logncdf*(xbar(+1)/z(+1)))*(xbar(+1)/z(+1)) + lognpdf(epsilon)% I don't
% know how to handle the limits of the integral in the second term.
SBtilde = lognpdf(unipdf(SB, a, sigmabar))% again I don't know how to
% handle the integral limits in the outer integral. And can unipdf have
% a variable as an uppper integral limit that I could compute sometime before
% running this line of code?
If this will not work, is there something else I can do? Can I use an external function file? I thought about writing an external function file but then I reached my wit's end thinking about how to handle these integral limits and multiple integrals.
1 Comment
Walter Roberson
on 1 May 2022
https://www.mathworks.com/matlabcentral/answers/435873-numerically-solve-integration-of-random-variable-using-symbolic-values#answer_352602
https://stackoverflow.com/questions/25931731/how-to-define-cumulative-normal-distribution-using-symbolic-math/25936113#25936113
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!