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) Traceback (most recent call last): File "<stdin>", line 1, in ? File "C:\Python23\Lib\site-packages\scipy\stats\distributions.py", line 125, in rvs return self.dist.rvs(*self.args,**kwds) File "C:\Python23\Lib\site-packages\scipy\stats\distributions.py", line 440, in rvs vals = reshape(self._rvs(*args),size) TypeError: _rvs() takes exactly 1 argument (3 given)
Any idea where I'm going wrong? Brian --Travis E. Oliphant wrote:
The help should be better now.
ie.
scipy.info(scipy.stats.triang)
...
_________________________________________________________________ Free yourself from those irritating pop-up ads with MSn Premium. Get 2months FREE* http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
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.
participants (2)
-
Brian Gue
-
Travis E. Oliphant