[SciPy-user] CDF/PDF Stats with SciPy

Omer Khalid Omer.Khalid@cern...
Mon Jul 20 15:11:29 CDT 2009


Hi Ivo,

Thanks for your reply. But I am getting a little confused here now. It seems
there are multiple ways to get the CDF for a distribution. You mean linspace
function returns a CDF for a normal distribution.

As far as I understood from other sources is that scipy.stats.norm.cdf
(mean, std) will return the CDF for the normal distribution or for
non-normal distribution given one replace *norm* with the distributions
name.

And what about scipy.stats.<dist>.fit function?
Thanks,
Omer

>
>
> Message: 7
> Date: Mon, 20 Jul 2009 12:07:10 -0400
> From: Ivo Maljevic <ivo.maljevic@gmail.com>
> Subject: Re: [SciPy-user] CDF/PDF Stats with SciPy
> To: SciPy Users List <scipy-user@scipy.org>
> Message-ID:
>        <826c64da0907200907m2775caa5jfe53ed515a456e5@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi Omer,
>
> For histogram you can either use histogram function from numpy/scipy:
>
> from scipy import *
>
> x = .... # some vector
> h,bins = histogram(x,50,normed=True,new=True) # find the histogram, number
> of bins = 50
>
> or you can use pylab's version (good for plotting):
>
> import matplotlib.pyplot as plt
>
> count, bins, ignored = plt.hist(x, 50, normed=True)
>
> For CDF you can use cumsum function (standard approach), but for smaller
> number of data points I
> prefer to use all the points, which is a neat trick:
>
>
> from scipy import *
>
> def my_cdf(x):
>
>  bins = sort(x)
>  cdf  = linspace(0,1,len(bins))
>  return [bins, cdf]
>
>
> 2009/7/20 Omer Khalid <Omer.Khalid@cern.ch>
>
> > Hi Everybody,
> >
> > I am new to Python and new to SciPy libraries. I wanted to take some ques
> > from the experts here on the list before dive into SciPy world.
> >
> > I was wondering if some one could provide a rough guide about how to run
> > two stats functions: Cumulative Distribution Function (CDF) and
> Probability
> > Distribution Function (PDF).
> >
> > My use case is the following: I have a sampleSpaceList [] which have 1000
> > floating point values. When a new floating point value is generated in my
> > program, I would like to run both CDF and PDF on the sampleList for it
> and
> > get the probabilty of value less or equal for CDF and probablity
> > distribution for PDF.
> >
> > Many thanks in advance!
> >
> > Omer
> >
> >
> > _______________________________________________
> > SciPy-user mailing list
> > SciPy-user@scipy.org
> > http://mail.scipy.org/mailman/listinfo/scipy-user
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mail.scipy.org/pipermail/scipy-user/attachments/20090720/bb4aebe5/attachment-0001.html
>
> ------------------------------
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
> End of SciPy-user Digest, Vol 71, Issue 32
> ******************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20090720/cbd0f83e/attachment.html 


More information about the SciPy-User mailing list