[SciPy-user] Is this a bug in stats.geom.pmf?
Stefan van der Walt
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 : k,p = 2.0,0.5
> In : (1-p)**(k-1)*p
> Out: 0.25
> In : stats.geom.pmf(k,p)
> Out: array(0.125)
> In : stats.geom.pmf(k-1,p)
> Out: 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.
More information about the SciPy-user