Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Linear combinations of Expectation of EmpiricalDistribution

  • To: mathgroup at
  • Subject: [mg128171] Re: Linear combinations of Expectation of EmpiricalDistribution
  • From: Clemens Fruhwirth <clemens at>
  • Date: Thu, 20 Sep 2012 00:26:07 -0400 (EDT)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • References: <>

On 18 September 2012 00:33, Clemens Fruhwirth <clemens at> wrote:

> * Am I missing an assumption here or some syntax? Or is this rule just
> not built into Mathematica?

For the archives:

Mathematica has the following rule for

    Statistics`ExpectationDump`f__] /;
      Statistics`ExpectationDump`f}, DataDistribution] && !
      Statistics`ExpectationDump`g_DataDistribution /;
       With[{Statistics`ExpectationDump`dom =
        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

  • Prev by Date: About CDF
  • Next by Date: Exact Schur Decomposition
  • Previous by thread: Re: Linear combinations of Expectation of EmpiricalDistribution
  • Next by thread: Epilog/Prolog and Show Question