calculate expected value of a function with respect to the distribution for discrete distribution
Parameters : | fn : function (default: identity mapping)
args : tuple
optional keyword parameters : lb, ub : numbers
conditional : boolean (False)
|
---|---|
Returns : | expected value : float |
Notes
function is not vectorized
for heavy tailed distribution e.g. zipf(4), accuracy for mean, variance in example is only 1e-5, increasing precision (moment_tol) makes zipf very slow
could be added as keyword parameter, to evaluate functions with non-monotonic shapes, points include integers in (-suppnmin, suppnmin)
to break loop for infinite sums (a maximum of suppnmin+1000 positive plus suppnmin+1000 negative integers are evaluated)