[SciPy-User] problem with computing moments of normal distribution

Mark Bakker markbak@gmail....
Wed Oct 14 05:12:22 CDT 2009


Hello List, I seem to have trouble computing the moments of a normal
distribution when the 'loc' keyword (I know, that's the mean in this case)
is specified.Any ideas? Here's my output:

In [207]: f = scipy.stats.norm()

In [208]: f.moment(1) # works
Out[208]: 0.0

In [209]: f = scipy.stats.norm(loc=1)

In [210]: f.moment(1) # doesn't work
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/Users/mark/models/whpa/brad/timeseriesmodel.py in <module>()
----> 1
      2
      3
      4
      5

/Library/Frameworks/Python.framework/Versions/5.0.0/lib/python2.5/site-packages/scipy/stats/distributions.py
in moment(self, n)
    131         return self.dist.stats(*self.args,**kwds)
    132     def moment(self,n):
--> 133         return self.dist.moment(n,*self.args,**self.kwds)
    134     def entropy(self):
    135         return self.dist.entropy(*self.args,**self.kwds)

TypeError: moment() got an unexpected keyword argument 'loc'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20091014/0e3822c8/attachment-0001.html 


More information about the SciPy-User mailing list