[SciPy-User] [Numpy-discussion] Fitting a curve on a log-normal distributed data

Robert Kern robert.kern at gmail.com
Tue Nov 17 19:00:40 EST 2009


On Tue, Nov 17, 2009 at 17:52, Gökhan Sever <gokhansever at gmail.com> wrote:

> I asked this in one of my early replies just repeating what is the way to
> get log-normal sample using scipy.stats? I will use it for a demonstrative
> case.
> For some reason, this never looks an expected log-normal sample to me:
>
> stats.lognorm.rvs(1,size=15)
>
> What am I missing here?

Are you expecting that to look like your 15-vector concentration data?
That's not what you should expect. Instead,

  x = stats.lognorm.rvs(1, size=10000)
  h = np.histogram(x, bins=15)

Now, the *histogram* of the samples should look like roughly like the
shapes that you are expecting. .rvs() produces the samples themselves.
I.e. pretend like each element is the size of an individual particle,
not the concentration of a size class of particles. Taking the
histogram "simulates" what your instrument does: it finds the amont of
particles in each size class.

> Thanks for your time and explanations Robert. I really appreciate your help.
> Probably I will include you in the acknowledgements part of my presentation.

Entirely unnecessary, of course.

-- 
Robert Kern

"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 mailing list