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

Robert Kern robert.kern@gmail....
Tue Nov 17 13:37:33 CST 2009

```On Tue, Nov 17, 2009 at 13:28, Gökhan Sever <gokhansever@gmail.com> wrote:
>
>
> On Tue, Nov 17, 2009 at 12:38 PM, <josef.pktd@gmail.com> wrote:

>> If conc where just lognormal distributed, then you would not get any
>> relationship between conc and size.
>>
>> If you have many observations with conc, size pairs then you could
>> estimate a noisy model
>> conc = f(size) + u  where the noise u is for example log-normal
>> distributed but you would still need to get an expression for the
>> non-linear function f.
>
> I don't understand why I can't get a relation between sizes and conc values
> if conc is log-normally distributed. Can I elaborate this a bit more? The
> non-linear relationship part is also confusing me. If say to test the linear
> relationship of x and y data pairs we just fit a line, in this case what I
> am looking is to fit a log-normal to get a relation between size and conc.

It's a language issue. Your concentration values are not log-normally
distributed. Your particle sizes are log-normally distributed (maybe).
The concentration of a range of particle sizes is a measurement that
is related to particle size the distribution, but you would not say
that the measurements themselves are log-normally distributed. Josef
was taking your language at face value.

>> If you want to fit a curve f that has the same shape as the pdf of
>> the log-normal, then you cannot do it with lognorm.fit, because that
>> just assumes you have a random sample independent of size.
>
> Could you give an example on this?

x = stats.norm.rvs()
stats.norm.fit(x)

>> So, it's not clear to me what you really want, or what your sample data
>> looks like (do you have only one 15 element sample or lots of them).
>
> I have many sample points (thousands) that are composed of this 15 elements.
> But the whole data don't look much different the sample I used. Most peaks
> are around 3rd - 4th channel and decaying as shown in the figure.

Do you need to fit a different distribution for each 15-vector? Or are
all of these measurements supposed to be merged somehow?

--
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
```