0
$\begingroup$

So, I'll explain the problem first. I have two populations that have values for two different channels (c1,c2). I've modeled these using MultinormalDistribution[]. I would like to add some noise to these distributions, which also exists in channels (c1,c2). I've tried doing this using TransformedDistribution[]:

hiDist = MultinormalDistribution[\[Mu]HiErr, \[CapitalSigma]];
loDist = MultinormalDistribution[\[Mu]LoErr, \[CapitalSigma]];
noiseDist = MultinormalDistribution[\[Mu]Noise, \[CapitalSigma]];

hiNDist = 
  TransformedDistribution[
   h + n, {h \[Distributed] hiDist, n \[Distributed] noiseDist}];
loNDist = 
  TransformedDistribution[
   l + n, {l \[Distributed] loDist, n \[Distributed] noiseDist}];

This works with regular Normal distributions, but fails when I use it with the Multinormal primitives. Any elegant way to do this?

EDIT 1 Changed a typo.

"Failure" results when I try to call the thing. In place, the TransformedDistribution[] call will just output something like:

    TransformedDistribution[\[FormalX]1 + \[FormalX]2, {\[FormalX]1 \
\[Distributed] 
   MultinormalDistribution[{5000, 
     20000}, {{1000000, 0}, {0, 
      1000000}}], \[FormalX]2 \[Distributed] 
   MultinormalDistribution[{2000, 
     2000}, {{1000000, 0}, {0, 1000000}}]}]

However, when I try to use the distribution, e.g.

RandomReal[hiNDist,100]

Mathematica will throw the error:

RandomReal::udist: "The specification TransformedDistribution[[FormalX]> 1+[FormalX]2, {[FormalX]1[Distributed]MultinormalDistribution[{5000,20000},{{1000000,0},{0,1000000}}],[FormalX]2[Distributed]MultinormalDistribution[{2000,2000},{{1000000,0},{0,1000000}}]}] is not a random distribution recognized by the system"

While the code

n1 = NormalDistribution[5000, \[Sigma]];
n2  = NormalDistribution[10000, \[Sigma]];
n3 = TransformedDistribution[
  x + y, {x \[Distributed] n1, y \[Distributed] n2}]

Gives the expected

NormalDistribution[15000, 1000 Sqrt[2]]
$\endgroup$
2
  • $\begingroup$ Could you detail "fails" as used here? Also providing the code of what you actually tried would be helpful. BTW I assume hiDist should be loDist in the second line, otherwise both distributions are identical. $\endgroup$ Commented Mar 14, 2014 at 16:34
  • $\begingroup$ Updated my question. And yep, that was a typo. $\endgroup$
    – Ted C
    Commented Mar 14, 2014 at 21:30

1 Answer 1

4
$\begingroup$

Try, e.g. (I just plugged in values from mu and sigma from your error text:

dist = MultinormalDistribution[{5000, 20000}, {{1000000, 0}, {0, 1000000}}]
noise = MultinormalDistribution[{2000, 2000}, {{1000000, 0}, {0, 1000000}}]

transformed = 
 TransformedDistribution[{a + c, b + d}, {{a, b} \[Distributed] dist,
                                          {c, d} \[Distributed] noise}]

RandomVariate[transformed]
Mean[transformed]

(*
{10056.9,22997.3}
{7000,22000}
*)
$\endgroup$
2
  • $\begingroup$ I see! So you have to explicitly describe each component of the output? $\endgroup$
    – Ted C
    Commented Apr 7, 2014 at 18:05
  • $\begingroup$ @ted: It appears that way. Some of the more esoteric corners of the Mathematica probability functionality sometimes need manual "tweaking". When I have to do such, I always spot-check it against expected values... $\endgroup$
    – ciao
    Commented Apr 7, 2014 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.