[SciPy-user] Re: random variates

Travis E. Oliphant oliphant at ee.byu.edu
Mon Apr 5 19:08:06 CDT 2004


Brian Gue wrote:
> Thanks for the help; I downloaded the April 1 package and the docstrings 
> are much better. Still having some problems, though. Triangular is 
> straightforward:
> 
>>>> from scipy import stats
>>>> triangRV = stats.triang(.7, loc=0, scale=2)
>>>> triangRV.rvs(10)
> 
> array([ 0.6086996 ,  1.30631752,  0.60636975,  0.8502878 ,  1.2694698 ,  
> 0.79918653,
>             1.51063519,  1.12854753,  1.35386416,  0.63519953])
> 
>>>>
> 
> 
> But truncated normal is not:
> 
>>>> truncnormRV = stats.truncnorm(0, 0.7, loc=0, scale=2)
>>>> truncnormRV.rvs(10)

You've found a bug.

I've fixed the problem in CVS.

You can fix it without downloading a new SciPy by changing the file 
stats/distributions.py

so that the truncnorm_gen class does not inherit from norm_gen (but from 
rv_continuous).

Then change all norm_gen. to norm.  in the methods and remove the self 
argument.




More information about the SciPy-user mailing list