Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: Linear combinations of Expectation of EmpiricalDistribution
Posted:
Sep 20, 2012 12:26 AM
|
|
On 18 September 2012 00:33, Clemens Fruhwirth <clemens@endorphin.org> wrote:
> * Am I missing an assumption here or some syntax? Or is this rule just > not built into Mathematica?
For the archives:
Mathematica 8.0.4.0 has the following rule for Statistics`ExpectationDump`iExpectation:
Statistics`ExpectationDump`iExpectation[Statistics`ExpectationDump`e_, Statistics`ExpectationDump`f__] /; Quiet[Internal`LiteralPresentQ[{Statistics`ExpectationDump`e, Statistics`ExpectationDump`f}, DataDistribution] && ! FreeQ[{Statistics`ExpectationDump`e, Statistics`ExpectationDump`f}, Statistics`ExpectationDump`g_DataDistribution /; With[{Statistics`ExpectationDump`dom = Statistics`Library`DataDistributionDomain[ Statistics`ExpectationDump`g]}, Head[Statistics`ExpectationDump`dom] === List && FreeQ[Statistics`ExpectationDump`dom, Interval]]]] := $Failed
To me, it reads as if it's a cut -- in the prolog sense of the word -- for the case where the domain of the DataDistribution is not an interval. I am not sure what to make of that rule, as I don't see the point of the cut for this special case. Maybe the second FreeQ is supposed to be !FreeQ?
If I remove this rules from the rule set, all my examples work just fine..
{Expectation[x + y, dist], Mean[TransformedDistribution[x + y, dist]], Variance[TransformedDistribution[x + y, dist]]} /. dist -> {x \[Distributed] EmpiricalDistribution[{0, 1, 2}], y \[Distributed] EmpiricalDistribution[{0, 10, 20}]}
{11, 11, 202/3}
I'll file a bug. -- Fruhwirth Clemens http://clemens.endorphin.org
|
|
|
|