Fri Sep 28 02:22:24 CDT 2007
Manu Hack wrote:
> Hi all,
> I have a quick question on scipy.stats.lognorm. From the manual it said:
> Lognormal distribution
> lognorm.pdf(x,s) = 1/(s*x*sqrt(2*pi)) * exp(-1/2*(log(x)/s)**2)
> for x > 0, s > 0.
> At the same time there are loc and scale to control the shape of the
Yes, they are omitted from the docstring because they behave in exactly the same
way for all distributions. Replace x with (x-loc)/scale if you want to be explicit.
> So it's like there are 3 parameters to control the
> shape of the distribution (but 2 should be enough to specify one).
> In fact, if we look at R, the function dlnorm, plnorm, etc. are
> simple and just did the job.
Ours is more general than R's, albeit in a somewhat unconventional way.
Conventionally, log-normal distributions are only defined on the positive real
line, and there is no location parameter. We extend this to the full real line
and add a location parameter to shift it. If you don't want it, don't use it.
> And after searching and trying different
> parameters and compare with R's function, I still couldn't figure out
> how to use scipy.stats.lognorm. So am I missing anything there?
The scale parameter here corresponds to the exponential of the mean of the
Gaussian in log-space (exp(meanlog) in the terms of the dlnorm documentation).
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the SciPy-user