How to plot a scaled lognormal function

Click For Summary
SUMMARY

This discussion focuses on plotting a scaled lognormal function using parameters μ=3.5, σ=1.5, and a specified maximum height of 4724. Participants clarify that the area of the lognormal distribution cannot be directly set to 1965, and instead, the function must be adjusted based on the maximum height. The final formula for the scaled lognormal function is provided as f(x) = 12744.4308932945 * lognormal(1.2, 0.34^2), ensuring the maximum height aligns with the desired value. The conversation emphasizes the need for a systematic approach to derive the scaling factor based on the maximum height and the lognormal parameters.

PREREQUISITES
  • Understanding of lognormal distribution parameters (μ and σ)
  • Familiarity with probability density functions (PDF)
  • Basic knowledge of scaling functions in statistical plotting
  • Experience with R or Excel for data visualization
NEXT STEPS
  • Learn how to derive the maximum of a lognormal distribution using its PDF
  • Explore scaling techniques for probability density functions in R
  • Investigate the relationship between maximum height and area under the curve for lognormal distributions
  • Study the use of iterative algorithms for finding maxima in statistical functions
USEFUL FOR

Statisticians, data analysts, and researchers involved in statistical modeling and visualization, particularly those working with lognormal distributions and requiring precise plotting techniques.

eduyu2018
Messages
8
Reaction score
0
Hi,
I am trying to plot a lognormal function. I have the value of μ=3.5, the value of σ=1.5 and the value of the Area = 1965. I have as well the value of the maximum height (Amp.=4724). I am tryiing to plot these with Excel or with R but I do not know how. I know how to plot a distribution of area 1 but not if the area is different.

Can you help me?
 
Physics news on Phys.org
I must be missing something. I plotted the lognormal PDF with parameters ##\mu=3.5## and ##\sigma=1.5##. That should have area 1, so I multiplied it by 1965 to get your desired area.
##f(x) = \frac{1965} {\sigma x \sqrt{2π} } e^{-\frac{(ln(x) - \mu)^2} {2\sigma^2}}##

The plot has a maximum of about 48.6 -- not close to the value 4724 that you specify. Are your ##\mu## and ##\sigma## the standard lognormal parameters?
 
You are right, the value of 1965 can not be the area.I think that the values you should enter into the function should be the ln of μ and σ. I tried both and still the values are not correct.

How can I plot the function but using the value of the height instead of the value of the area? I am sure that the height is 4724. How can I obtain the area if I know the height of the maximum μ and σ? Or how can I plot it?

Thank you!
 
Last edited:
I know from my earlier plot, that the maximum of the lognormal(3.5,1.5) PDF is about 48.61/1965 = 0.024737913486. So you can multiply the lognormal PDF by 4724/0.024737913486 = 190,962.
Plot
##f(x) = \frac{190962} {\sigma x \sqrt{2π} } e^{-\frac{(ln(x) - \mu)^2} {2\sigma^2}}##
 
If I plot ths funtion, the maximum height is not 4724. I am looking for a way to plot the lognormal funtion if I know μ and σ and the maximum height.

Thank you!
 
I get a maximum height of 4724.07 at x=3.49. What do you get?
 
Ok, my maximum is different because I am putting the ln of μ and σ. If I put your values I obtain the same. I should introduce μ and σ or the ln of μ and σ.

Independently of this. Do you think I can find a function to directly plot the graph if I know the maximum height, μ and σ? I have to represent different functions and I don't want to do the process with each one to find the value of 190962 or 14800 if I use the ln
 
Just to make sure we are talking about the same thing:
I am using the ##\mu_Z## and ##\sigma_Z## of the lognormal distributed variable ##X = e^{\mu_Z+\sigma_ZS}##, where S is a standard normal random variable. S is standard normal. ##Z=\mu_Z+\sigma_ZS## is normally distributed with mean ##\mu_Z## and standard deviation ##\sigma_Z##. Then ##\mu_Z## and ##\sigma_Z^2## are the usual parameters of the lognormal X but not the statistical mean and variance of it.
(See https://en.wikipedia.org/wiki/Log-normal_distribution.)

From the link, the statistical mean and variation of the lognormal random ##X## is ##\mu_X = e^{\mu_Z + \frac {\sigma_Z^2}{2}}## and ##\sigma_X^2 = (e^{\sigma_Z^2}-1)e^{2\mu_Z+\sigma_Z^2}##.
It sounds like you are not saying that ##\mu_Z = 3.5## and ##\sigma_Z=1.5##
Are you saying that ##\mu_X = 3.5## and ##\sigma_X=1.5##? Or are you talking about yet another random variable ##Y=1965 X## which has area 1965, and saying that ##\mu_Y = 3.5## and ##\sigma_Y=1.5##?
 
Last edited:
Hi, thank you again for your time. You are right, I am saying my ##\mu_x=3.5## and my ##\sigma_x=1.5##. The ##\mu_z## and ##\sigma_z## are respectively 1.2 and 0.34 (using the equations you send me). I get the maximum at x=2.9 aprox.

Forget about the 1965, I thhought it was the area, but it is not. I know that the height at the maximum of my distribution is 4772 and I want a formula to plot the distribution if I know ##\mu_z##, ##\sigma_z## and this height.
 
  • #10
Ok. Plotting ##f(x) = lognormal(1.2, 0.34^2)## I could find maximum of 0.37 at x=3.49. I scaled that and plotted (4772/0.37)f(x). In that plot I could find a maximum of 4829.239 at x=2.957. So I scaled again and plotted ##(4772/4829.239)(4772/0.37)f(x) = 12744.4308932945 f(x)## . Zooming in on that plot, it looked like it has a maximum of 4772.00004 at x=2.9576682.
 
  • #11
Umm, I do not know why the maximum changes from 3,49 to 2,96

But then I have to know first the maximum of the distribution (this 0,37). This value is going to change depending of the distribution (##\mu## and ##\sigma##). I would like to fine a faster method to plot the function without having to plot first the non-scaled distribution.

I understant that the value of 12744 is the area of the new function. Is there an expresion relating this number with the height at the maximum, ##\mu## and ##\sigma##?
 
  • #12
eduyu2018 said:
Umm, I do not know why the maximum changes from 3,49 to 2,96
You can verify that the value of the PDF at ##x=2.9576682, \mu=1.2, \sigma=0.34## is 0.37443806439 by using the PDF calculator in https://www.medcalc.org/manual/log-normal_distribution_functions.php.
But then I have to know first the maximum of the distribution (this 0,37). This value is going to change depending of the distribution (##\mu## and ##\sigma##). I would like to fine a faster method to plot the function without having to plot first the non-scaled distribution.
I guess you could calculate the derivative of the PDF and get an equation for the zero of it (that might require an iterative algorithm). From that, you can calculate the maximum at that point and scale appropriately.
I understant that the value of 12744 is the area of the new function. Is there an expresion relating this number with the height at the maximum, ##\mu## and ##\sigma##?
The scale factor, S, the you use to set the maximum at the desired maximum will also scale the integral of the PDF (the area) from one to S.
 
  • #13
Thank you for your comments. I will do it in that way. I have to do a lot of this plots and I was wishing it would be an easy way to plot all just with a formula including the height.
Thanks!
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 24 ·
Replies
24
Views
4K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
Replies
7
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 7 ·
Replies
7
Views
2K