2
$\begingroup$

Why is the Mathematica resulting in the weird output whenever the number of variables in the transformed distribution becomes greater than the number of variables in the original multivariate Normaldistribution?

This is correct:

TransformedDistribution[{y1 + y2, y1 + y3, y1 + y4, 
  y2 + y3}, {y1, y2, y3, y4} \[Distributed] 
  MultinormalDistribution[{\[Mu]1, \[Mu]2, \[Mu]3, \[Mu]4}, 
   IdentityMatrix[4]]]

results in correct output

MultinormalDistribution[{\[Mu]1 + \[Mu]2, \[Mu]1 + \[Mu]3, \[Mu]1 + \
\[Mu]4, \[Mu]2 + \[Mu]3}, {{2, 1, 1, 1}, {1, 2, 1, 1}, {1, 1, 2, 
   0}, {1, 1, 0, 2}}]

But this

TransformedDistribution[{y1 + y2, y1 + y3, y1 + y4, y2 + y3, y1 + y2 + y3 + y4}, {y1, y2, y3, y4} \[Distributed]    MultinormalDistribution[{\[Mu]1, \[Mu]2, \[Mu]3, \[Mu]4},     IdentityMatrix[4]]]

results in weird output

TransformedDistribution[{\[FormalX]1 + \[FormalX]2, \[FormalX]1 + \
\[FormalX]3, \[FormalX]1 + \[FormalX]4, \[FormalX]2 + \[FormalX]3, \
\[FormalX]1 + \[FormalX]2 + \[FormalX]3 + \[FormalX]4}, {\[FormalX]1, \
\[FormalX]2, \[FormalX]3, \[FormalX]4} \[Distributed] 
  MultinormalDistribution[{\[Mu]1, \[Mu]2, \[Mu]3, \[Mu]4}, {{1, 0, 0,
      0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}]]

Is this some Mathematica bug or bug in my understanding?

thanks

$\endgroup$
2
  • 4
    $\begingroup$ The second distribution is correct. Mathematica doesn't know a shorter or simpler representation of the distribution so it is represented as the input distribution with formal variables. If that distribution is called dist then you can evaluate Mean[dist] or StandardDeviation[dist] as you would with any distribution.. $\endgroup$
    – Bob Hanlon
    May 11, 2022 at 5:31
  • $\begingroup$ PDF[TransformedDistribution[{y1+y2,y1+y3,y1+y4,y2+y3,y1+y2+y3+y4},{y1,y2,y3,y4}\[Distributed]MultinormalDistribution[{\[Mu]1,\[Mu]2,\[Mu]3,\[Mu]4},IdentityMatrix[4]]],{t1,t2,t3,t4,t5}] fails in 13 on Windows 10. Every command has its limitations. $\endgroup$
    – user64494
    May 11, 2022 at 5:59

1 Answer 1

8
$\begingroup$

In short, your examples are of multivariate normals with covariance matrices that are not positive definite. (They are symmetric just not symmetric positive definite.)

As @BobHanlon mentions, Mean[dist] and StandardDeviation[dist] work fine.

Another command that works fine is Covariance:

dist = TransformedDistribution[{y1 + y2, y1 + y3, y1 + y4, y2 + y3, y1 + y2 + y3 + y4}, 
  {y1, y2, y3, y4} \[Distributed] MultinormalDistribution[{μ1, μ2, μ3, μ4}, IdentityMatrix[4]]]

(cov = Covariance[dist]) // MatrixForm

Covariance matrix

But cov is singular:

Det[cov]
(* 0 *)

So my guess is that is probably related to the issue you're finding.

Suppose we try to construct the multivariate normal from knowing that covariance matrix:

MultinormalDistribution[cov]

This fails with the error message

Error message

Now suppose we construct a multivariate normal distribution from that covariance matrix (which doesn't know that it was constructed from 4 independent normals) and specify the mean:

dist2 = MultinormalDistribution[{0, 0, 0, 0, 0}, cov]

No error messages are given. But try Mean:

dist2 = MultinormalDistribution[{0, 0, 0, 0, 0}, cov];
Mean[dist2]

Error message about not having a symmetric positive definite matrix

So I think it's all about not having a symmetric positive definite matrix in your examples.

$\endgroup$

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.