Hey there! I’m trying to draw random numbers from a Log-Normal distribution with a given mean and standard-deviation. As far as i know, the LogNormal(\mu \sigma) lets you set the mean and standard deviation of the distribution. I am not really clear however, if I should feed the function with log(valuex) or just with value x, for either mu or sigma. I’m not so sure, what the documentation tries to explain (maybe it’s lack of maths…). it states:
LogNormal(mu, sig) # Log-normal distribution with log-mean mu and scale sig
So how do I do this? Say, I want to use x as mean and y as scale, do I draw from LogNormal(log(x), y)? In R I would use the log(x), but how about Julia? Thanks so much!
Notice that σ is not the standard deviation of the LogNormal distribution, e.g.
julia> std(LogNormal(0,1))
2.1611974158950877
so if your inputs are the mean and standard deviation then the problem of finding μ and σ is a bit harder since there is no closed form solution. I actually had to do this recently and ended up doing something like
The .txt contains the data I’m using the get the distribution, I didn’t think it would be necessary to give mock-data so you can copy what I did, but rather to illustrate, how I calculated μ and σ.
For me, it seems similar to what you did (?), but I’m not familiar with the Optim.minimizer function you used. However, my supervisor agreed on my calculation, so I guess, for my purposes it works.
Thank you anyways!
Thanks @EvoArt ! I don’ know if this is what you have in mind, but one important design point about MeasureTheory is to make it easy to work with different parameterizations. The setup is that a ParameterizedMeasure is just a struct with a NamedTuple field, and we use KeywordCalls.jl for dispatch.
So for example, we can have a LogNormal(μ,σ) set up to work exactly like Distributions, and also have LogNormal(moments=(m,std)) available.
To be fair, Distributions could be adapted to do this as well, but in that case it would probably just build a LogNormal with the standard parameterization. The advantage of the MeasureTheory approach is that we allow different parameterizations to be used directly, without conversion to some standard form. Here that doesn’t help so much (I think you’d probably want to convert it anyway), but in some cases it can make things much more efficient.