find the σ and the μ of the lognormal function, having 1st percentile and the 99th percentile

13 views (last 30 days)
I have to build find the σ and the μ of the lognormal function, having the value of the 1st percentile (which is 30) and the 99th percentile (which is 60).
Do you have any suggestion to do it simply with matlab
Thank you in advance (be nice, I am not a statistic guru, I have already tried to solve it by myself searching a lot in statistic book)
  2 Comments
Adam Danz
Adam Danz on 21 Nov 2019
"I have to build find the σ and the μ of the lognormal function"
So far the problem is easy. Assuming these variables carry the conventional meanings, μ is just the function mean() and σ is just the function std()
"...having the value of the 1st percentile (which is 30) and the 99th percentile (which is 60)."
This is where I start to lose you. Are you trying to create the lognormal distribution with those percentile requirements or do you have those data already and are merely trying to compute σ and μ ?

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 21 Nov 2019
First you need to understand the math problem, then you can use MATLAB to solve numerically.
You can find the CDF of the lognormal distribution in this wikipedia section. So, you'll have two simultaneous equations (each equation is a function of σ and μ):
  • Eq 1: cdf of the lognormal at 30 = 0.01
  • Eq 2: cdf of the lognormal at 60 = 0.99
This is two equations in two unknowns, and with bit of manipulation, I believe can make this two linear equations in two unknowns.
Since this seems like homework, I think maybe that's enough of a hint to get you going.
  7 Comments
the cyclist
the cyclist on 21 Nov 2019
Edited: the cyclist on 21 Nov 2019
I need to think a bit more carefully, but I'm pretty sure the code
x=0:1:150
lgn=lognpdf(x,solx, soly)
plot(x, lgn)
Y = prctile(lgn,1)
is not a valid way to find the 1st percentile of the distribution.
This should give approximately 0.01
logncdf(30,solx,soly)
and
logninv(0.01,solx,soly)
should give 30, if solx and soly are the correct distribution parameters.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!