[Scipy-svn] r5078 - trunk/scipy/stats
scipy-svn at scipy.org
scipy-svn at scipy.org
Wed Nov 12 22:48:57 EST 2008
Author: josef
Date: 2008-11-12 21:48:56 -0600 (Wed, 12 Nov 2008)
New Revision: 5078
Modified:
trunk/scipy/stats/distributions.py
Log:
corrections in discrete distributions randint, and dlaplace, skip partially broken dlaplace._stats
Modified: trunk/scipy/stats/distributions.py
===================================================================
--- trunk/scipy/stats/distributions.py 2008-11-13 03:37:39 UTC (rev 5077)
+++ trunk/scipy/stats/distributions.py 2008-11-13 03:48:56 UTC (rev 5078)
@@ -4080,6 +4080,8 @@
# FIXME: Fails _cdfvec
class logser_gen(rv_discrete):
def _rvs(self, pr):
+ # looks wrong for pr>0.5, too few k=1
+ # trying to use generic is worse, no k=1 at all
return mtrand.logseries(pr,size=self._size)
def _argcheck(self, pr):
return (pr > 0) & (pr < 1)
@@ -4238,7 +4240,7 @@
k = floor(x)
return (k-min+1)*1.0/(max-min)
def _ppf(self, q, min, max):
- val = ceil(q*(max-min)+min)
+ val = ceil(q*(max-min)+min)-1
return val
def _stats(self, min, max):
m2, m1 = arr(max), arr(min)
@@ -4324,8 +4326,13 @@
const = 1.0/(1+exp(-a))
cons2 = 1+exp(a)
ind = q < const
- return ceil(1.0/a*where(ind, log(q*cons2)-1, -log((1-q)*cons2)))
- def _stats(self, a):
+ return ceil(where(ind, log(q*cons2)/a-1, -log((1-q)*cons2)/a))
+
+ def _stats_skip(self, a):
+ # variance mu2 does not aggree with sample variance,
+ # nor with direct calculation using pmf
+ # remove for now because generic calculation works
+ # except it does not show nice zeros for mean and skew(?)
ea = exp(-a)
e2a = exp(-2*a)
e3a = exp(-3*a)
More information about the Scipy-svn
mailing list