[SciPy-Dev] [stats] discrete vs continuous distributions, arguments
Evgeni Burovski
evgeny.burovskiy@gmail....
Fri Jun 14 19:11:19 CDT 2013
Dear experts,
Could somebody comment on the way how continuous and discrete distributions
handle their positional arguments --- especially where there are too many
of them. For example:
>>> from scipy.stats import poisson, norm
>>> poisson.pmf(42, 41) # k=42, \mu=41
0.060697388909241624
>>>
>>> poisson.pmf(42, 41, -101) # gets shifted by -101?
1.7221234070193835e-35
>>> poisson.pmf(42+101, 41) # indeed
1.7221234070193835e-35
>>>
>>> norm.pdf(39, 41, 2) # N(41, 2) at x=39 ?
0.12098536225957168
>>> np.exp(-1./2)/np.sqrt(2.*np.pi*2**2) # indeed, it is
0.12098536225957168
>>>
>>> norm.pdf(39, 41, 2, -101) # is it N(41+101, 2) at x=39? or at
x=39+101?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/home/br/.local/lib/python2.7/site-packages/scipy/stats/distributions.py",
line 1212, in pdf
args, loc, scale = self._fix_loc_scale(args, loc, scale)
File
"/home/br/.local/lib/python2.7/site-packages/scipy/stats/distributions.py",
line 545, in _fix_loc_scale
raise TypeError("Too many input arguments.")
TypeError: Too many input arguments.
>>>
I understand what happens in the code (the `loc` parameter is free for
`poisson` and is fixed at `mu` for norm), but I'm at loss whether this
disparity is by design --- is it a feature or a bug or just my
misunderstanding?
Zhenya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20130615/34f6b62a/attachment.html
More information about the SciPy-Dev
mailing list