However, the scipy documentation indicates that a lognormal distribution can be configured with lognorm, using scale and shape s, with scale = exp(mu) and s = sigma with mu and sigma being the mean and standard deviation of the corresponding normal distribution. This means that mu = param.default and sigma = param.std for a lognormal-distributed parameter.
BUT apparently scale takes the median (exp(mu)) and not the mean, so you should not pass np.exp(param.default) but rather the following:
It is confusing, because using the log-transformed mean and the non-transformed standard deviation is inconsistent, but it seems to yield the right results.
Hi, we have been struggling with @alvarojhahn about how the lognormal distribution is defined.
The lognormal sampling for a given parameter is done at the following line of code: https://github.com/oie-mines-paristech/lca_algebraic/blob/46144bff6096487fda2aacc57625fc94d8e047eb/lca_algebraic/params.py#L274
However, the
scipy
documentation indicates that a lognormal distribution can be configured withlognorm
, using scale and shape s, withscale = exp(mu)
ands = sigma
withmu
andsigma
being the mean and standard deviation of the corresponding normal distribution. This means thatmu = param.default
andsigma = param.std
for a lognormal-distributed parameter.BUT apparently
scale
takes the median (exp(mu)
) and not the mean, so you should not passnp.exp(param.default)
but rather the following:It is confusing, because using the log-transformed mean and the non-transformed standard deviation is inconsistent, but it seems to yield the right results.