Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2012

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

Search the Archive

Linear combinations of Expectation of EmpiricalDistribution

  • To: mathgroup at
  • Subject: [mg128132] Linear combinations of Expectation of EmpiricalDistribution
  • From: Clemens Fruhwirth <clemens at>
  • Date: Tue, 18 Sep 2012 03:40:19 -0400 (EDT)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:

Dear MathGroup,

The expectation for any linear combination of random values is the
linear combination of the respective expectations of the random
values, such as

E(aX+bY) = aE(X) + bE(Y)

I wonder why Mathematica can't resolve this rule when
EmpiricalDistributions come into play. For instance,

 x + y, {x \[Distributed] EmpiricalDistribution[{0, 1, 2}],
  y \[Distributed] EmpiricalDistribution[{0, 10, 20}]}]

I came up with:

  a_ + b_, {x_ \[Distributed] xdist_, y_ \[Distributed] ydist_}] :=
 a + b //. {x -> Expectation[x, x \[Distributed] xdist],
   y -> Expectation[y, y \[Distributed] ydist]}

to resolve at least simple addition. But before I put more work into that:

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

* Is that in general the right approach to extend Mathematica?

Fruhwirth Clemens

  • Prev by Date: Re: primitive root error
  • Next by Date: Epilog/Prolog and Show Question
  • Previous by thread: How to use mathematica to solve this problem
  • Next by thread: Re: Linear combinations of Expectation of EmpiricalDistribution