Re: Linear combinations of Expectation of EmpiricalDistribution
- To: mathgroup at smc.vnet.net
- Subject: [mg128171] Re: Linear combinations of Expectation of EmpiricalDistribution
- From: Clemens Fruhwirth <clemens at endorphin.org>
- Date: Thu, 20 Sep 2012 00:26:07 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <CAG6gW_sTEUKoWeQASsHb03jJf1B8PGtTeFzRvToYuc_kXmXyFQ@mail.gmail.com>
On 18 September 2012 00:33, Clemens Fruhwirth <clemens at 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