How to plot a scaled lognormal function

In summary, the lognormal function has a maximum of about 48.6. If you want to plot it, you need to enter the ln of μ and σ into the function.
  • #1
eduyu2018
8
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
  • #2
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?
 
  • #3
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:
  • #4
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}}##
 
  • #5
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!
 
  • #6
I get a maximum height of 4724.07 at x=3.49. What do you get?
 
  • #7
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
 
  • #8
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:
  • #9
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!
 

1. What is a lognormal function and why is it important in scientific research?

A lognormal function is a mathematical function that is commonly used to model data that follows a normal distribution after taking the natural logarithm. This type of function is important in scientific research because many natural phenomena can be described by lognormal distributions, such as the sizes of particles in a sample or the prices of financial assets.

2. How do I plot a scaled lognormal function?

To plot a scaled lognormal function, you will need to determine the parameters of the function, including the mean and standard deviation of the underlying normal distribution. Then, you can use a graphing calculator or software to plot the function by inputting the formula and the desired scaling factor. Alternatively, you can manually calculate the function values and plot them on a graph.

3. What is the difference between a normal and a lognormal distribution?

A normal distribution is a symmetrical bell-shaped curve that is commonly used to model data in which most values are clustered around the mean, with fewer values at the extremes. A lognormal distribution, on the other hand, is a skewed curve that is obtained by taking the natural logarithm of a normal distribution. In a lognormal distribution, the majority of values are concentrated at the low end, with a few extreme values at the high end.

4. Can a lognormal function be used to approximate any type of data?

No, a lognormal function is only appropriate for data that follows a lognormal distribution. If your data does not follow this type of distribution, using a lognormal function will not accurately represent your data and may lead to incorrect conclusions.

5. How can I interpret the parameters of a scaled lognormal function?

The parameters of a scaled lognormal function can provide information about the central tendency and spread of the data. The mean of the underlying normal distribution can be interpreted as the average value of the data, while the standard deviation can be used to describe the variability or spread of the data. The scaling factor can be used to adjust the overall shape and magnitude of the function.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
2K
  • General Discussion
Replies
2
Views
390
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
383
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
782
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
910
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
1K
Replies
24
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
257
Back
Top