[SciPy-user] probability tools in scipy

Robert Kern robert.kern at gmail.com
Tue Mar 6 16:40:05 EST 2007


Thomas Nelson wrote:
> I'm looking for a function something like:
> 
> normalcdf(lo,hi,mu,sigma)
> that returns the probability that
> lo < X < hi
> where X is a normal random variable with mean = mu and standard deviation 
> = sigma.  Is there something like this, or a tool to make something like 
> this, in scipy?  I looked at the scipy.stats.distributions module, but as 
> far as I can tell that seems to be more of a random number generator.  Am 
> I correct about this?  does scipy have something like the functionality 
> I'm looking for?

from scipy import stats

stats.norm.cdf(hi, mu, sigma) - stats.norm.cdf(lo, mu, sigma)

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