On Thu, Aug 23, 2012 at 1:24 PM, <josef.pktd@gmail.com> wrote:
On Thu, Aug 23, 2012 at 1:11 PM, nicky van foreest <vanforeest@gmail.com> wrote:
Hi,
I noticed that rv_frozen does not have an expect attribute. Is there a design reason for this? It feels somewhat unnatural to me that frozen distributions cannot be used directly to compute expectations.
oversight to add it, I guess.
can be added and it can delegate like in the other methods. PR welcome. frozen_dist.dist.expect(..)
(I almost never work with frozen distribution and didn't see this.)
miss = set(dir(stats.norm)) - set(dir(stats.norm(loc=5))) [i for i in miss if not i[0]=='_'] ['moment_type', 'xb', 'xa', 'freeze', 'badvalue', 'expect', 'xtol', 'vecentropy', 'fit_loc_scale', 'expandarr', 'fit', 'vecfunc', 'est_loc_scale', 'logsf', 'logcdf', 'logpdf', 'generic_moment', 'numargs', 'name', 'a', 'nnlf', 'b', 'm', 'shapes', 'extradoc', 'veccdf'] import scipy scipy.__version__ '0.9.0'
'logsf', 'logcdf', 'logpdf', are also missing (in my version of scipy) Josef
Josef
bye
Nicky
On 23 August 2012 18:36, nicky van foreest <vanforeest@gmail.com> wrote:
Hi Josef,
Thanks for your answers.
return scipy.integrate.quad(lambda x: x*g(x), X.dist.a, X.dist.b)
X = stats.norm(3,sqrt(3)) print E(sqrt, X)
I don't know why this works, sqrt of a normal distributed random variable has lots of nans (or complex numbers)
You are right, it shouldn't work. The point is that my code above is this: lambda x: x*g(x), while it should have been lambda x: f(x)*g(x).
I'll give expect a try.
Nicky
SciPy-User mailing list SciPy-User@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user