Lognormal distribution parameters mu and sigma

44 vues (au cours des 30 derniers jours)
Day
Day le 9 Avr 2024 à 19:33
Commenté : Day le 9 Avr 2024 à 20:33
Hi,
I want to generate a lognormal distribution for a set of data measurments using Simbiology model analyzer. I need to insert the mu and sigma for of this distribution as shown in the attachment. Is mu=log(mean) and sigma=log(Standard deviation)?
Thank you!

Réponse acceptée

John D'Errico
John D'Errico le 9 Avr 2024 à 19:45
Modifié(e) : John D'Errico le 9 Avr 2024 à 20:24
In MATLAB, the tools that use a lognormal distribution have you provide mu and sigma in terms of the underlying normal distribution. For example...
help lognrnd
LOGNRND Random arrays from the lognormal distribution. R = LOGNRND(MU,SIGMA) returns an array of random numbers generated from the lognormal distribution with parameters MU and SIGMA. MU and SIGMA are the mean and standard deviation, respectively, of the associated normal distribution. The size of R is the common size of MU and SIGMA if both are arrays. If either parameter is a scalar, the size of R is the size of the other parameter. R = LOGNRND(MU,SIGMA,M,N,...) or R = LOGNRND(MU,SIGMA,[M,N,...]) returns an M-by-N-by-... array. The mean and variance of a lognormal random variable with parameters MU and SIGMA are M = exp(MU + SIGMA^2/2) V = exp(2*MU + SIGMA^2) * (exp(SIGMA^2) - 1) Therefore, to generate data from a lognormal distribution with mean M and Variance V, use MU = log(M^2 / sqrt(V+M^2)) SIGMA = sqrt(log(V/M^2 + 1)) See also LOGNCDF, LOGNFIT, LOGNINV, LOGNLIKE, LOGNPDF, LOGNSTAT, RANDOM, RANDN. Documentation for lognrnd doc lognrnd
In that help, you can see how to choose mu and sigma, IF you know the mean and variance of the distribution you wish to see.
That is, if you know the mean and variance of the lognormal distribution you wish, choose mu and sigma as:
MU = log(M^2 / sqrt(V+M^2))
SIGMA = sqrt(log(V/M^2 + 1))
For example, choosing a lognormal with mean 2, and standard deviation 0.5 (so a variance of 0.25) we would see:
M = 2;
V = 0.25;
MU = log(M^2 / sqrt(V+M^2))
MU = 0.6628
SIGMA = sqrt(log(V/M^2 + 1))
SIGMA = 0.2462
X = lognrnd(MU,SIGMA,[1e8,1]);
mean(X)
ans = 2.0001
std(X)
ans = 0.5000
And that is exactly what we would expect from a random sample. I believe Simbiology would use the same version of a lognormal distribution.
  1 commentaire
Day
Day le 9 Avr 2024 à 20:33
Thank you very much

Connectez-vous pour commenter.

Plus de réponses (1)

Bruno Luong
Bruno Luong le 9 Avr 2024 à 19:45
Modifié(e) : Bruno Luong le 9 Avr 2024 à 19:47
Is mu=log(mean) and sigma=log(Standard deviation)?
If X is log-normal random variable
  • mu is mean of log(X)
  • sigma is standard deviation of log(X)
  • log(X) is Gaussian random variable
  1 commentaire
Day
Day le 9 Avr 2024 à 20:32
Thank you very much

Connectez-vous pour commenter.

Communautés

Plus de réponses dans  SimBiology Community

Catégories

En savoir plus sur Import Data dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by