Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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]]
share|improve this question
    
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. –  Sjoerd C. de Vries Mar 14 at 16:34
    
Updated my question. And yep, that was a typo. –  Ted C Mar 14 at 21:30

1 Answer 1

up vote 3 down vote accepted

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}
*)
share|improve this answer
    
I see! So you have to explicitly describe each component of the output? –  Ted C Apr 7 at 18:05
    
@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... –  rasher Apr 7 at 21:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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