[SciPy-user] Is this a bug in stats.geom.pmf?
Stefan van der Walt
stefan@sun.ac...
Mon Jun 25 17:01:02 CDT 2007
On Mon, Jun 25, 2007 at 02:59:09PM -0600, Fernando Perez wrote:
> just curious. The stats.geom docstring says:
>
> Geometric distribution
>
> geom.pmf(k,p) = (1-p)**(k-1)*p
> for k >= 1
>
> But I see this:
>
> In [10]: k,p = 2.0,0.5
>
> In [11]: (1-p)**(k-1)*p
> Out[11]: 0.25
>
> In [12]: stats.geom.pmf(k,p)
> Out[12]: array(0.125)
>
> However:
>
> In [13]: stats.geom.pmf(k-1,p)
> Out[13]: array(0.25)
>
>
> Is this an off-by-one bug, or am I misreading something here?
Yes, a mistake in geom._pmf that would never have shown up, since it
does not have a unit test. I'll fix it, unless you beat me to it.
Cheers
Stéfan
More information about the SciPy-user
mailing list