[SciPy-user] lognormal distribution

Robert Kern rkern at ucsd.edu
Sun Feb 13 05:46:47 EST 2005


Gary wrote:
> Robert Kern wrote:

>> Is there anything else you need?
>>
> World peace and/or longer prison sentences for parole violators?      

Scipy is a large, broad package, but I think this may be outside its 
purview.

> I wasn't aware of  the rvs() method.  Now I am.
> I've never heard of kernel density estimate.  Now I have.  I think I'll 
> try it out on data from the intro physics lab that I teach.  The 
> students are seeing histograms for the first time, and they don't like 
> it when the ones they get with their data don't look like the nice bell 
> curves in the book.

Kernel density estimation is a fairly broad subject all by itself and 
something of an art rather than science. What I implemented is fairly 
basic, although that may be just fine for an intro physics lab. There is 
at least one other Python package for doing KDE that has some more options.

Particularly, one problem with Gaussian kernels is that they have 
infinite support; they are non-zero across the whole, infinite domain. 
This feature may not be desirable for some data, like those which are 
constrained to be positive.

And for the univariate case, you can sometimes get better (in the area 
of KDE "better" == "looks nicer to me") with what is called "k-nearest 
neighbors;" the width of each kernel gets adjusted to be peakier where 
there are lots of data and flatter where there is less data.

KDE is a twiddler's paradise.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the SciPy-User mailing list