1
$\begingroup$

I am trying to compute the following:

Assume that $(a, b, c)$ are jointly normal with unknown means $(\mu_a, \mu_b, \mu_c)$ and variance-covariance matrix $\Sigma$.

What is $E[exp(a)|a>0, b>0, c>0]$?

When I input this into Mathematica, it hangs and fails to produce a result. My sense is that this is because I'm not telling it that $\Sigma$ is positive-definite (obviously it can tell that $\Sigma$ is symmetric).

My code is

Expectation[Exp[a] \[Conditioned] {a > 0, b > 0, c > 0},
 {a, b, c} \[Distributed] 
  MultinormalDistribution[{μa, μb, μc},
   {{σaa, σab, σac}, {σab, σbb, σbc}, {σac, σbc, σcc}}]]

Following the suggestion of using TruncatedDistribution, I tried running the following:

Expectation[Exp[x], 
 x \[Distributed] 
  MarginalDistribution[
   TruncatedDistribution[{{0, ∞}, {0, ∞}, {0, ∞}}, 
    MultinormalDistribution[{μa, μb, μc},
      {{s11, s12, s13}, {s12, s22, s23}, {s13, s23, s33}}]], 1]]
$\endgroup$
  • $\begingroup$ Please include your Mathematica code. $\endgroup$ – JimB Mar 4 '17 at 0:50
  • $\begingroup$ What code did you use for the two-variable case? $\endgroup$ – David G. Stork Mar 4 '17 at 0:50
  • $\begingroup$ Yep. That's why I deleted my comment. $\endgroup$ – David G. Stork Mar 4 '17 at 0:55
  • $\begingroup$ Updated to include code $\endgroup$ – Shffl Mar 4 '17 at 0:57
3
$\begingroup$

Since you're only interested in the $x$ variable, form the Marginal Distribution by (effectively) integrating over $y$ and $z$. Then either do an integration over positive $x$:

Integrate[
 x PDF[MarginalDistribution[
    MultinormalDistribution[{μa, μb, μc}, 
      {{s11, s12, s13}, {s12, s22, s23}, {s13, s23, s33}}], 1], x], 
{x, 0, ∞}]

  (*
    ConditionalExpression[(
     E^(-(μa^2/(2 s11))) s11 + 
      Sqrt[π/2] Sqrt[
       s11] μa (1 + Erf[μa/(Sqrt[2] Sqrt[s11])]))/(
     Sqrt[2 π] Sqrt[s11]), (Re[s11] >= 0 && Re[μa/s11] < 0) || 
      Re[s11] > 0]
  *)

or a one-dimensional Expectation over the new distribution.

Basic sanity check:

Expectation[x, 
 x \[Distributed] 
  MarginalDistribution[
   MultinormalDistribution[{μa, μb, μc}, {{s11, s12, 
      s13}, {s12, s22, s23}, {s13, s23, s33}}], 1]]

  (*
    μa
  *)

So here is nearly the final answer (which does not constrain $y$ and $z$ to be positive):

Expectation[Exp[x] \[Conditioned] x > 0, 
 x \[Distributed] 
  MarginalDistribution[
   MultinormalDistribution[{μa, μb, μc}, 
    {{s11, s12, s13}, {s12, s22, s23}, {s13, s23, s33}}], 1]]

$\frac{e^{\text{$\mu $a}+\frac{\text{s11}}{2}} \left(\text{erf}\left(\frac{\text{$\mu $a}+\text{s11}}{\sqrt{2} \sqrt{\text{s11}}}\right)+1\right)}{\text{erfc}\left(-\frac{\text{$\mu $a}}{\sqrt{2} \sqrt{\text{s11}}}\right)}$

I think to constrain $y$ and $z$ to be positive you'll have to use TruncatedDistribution. (I may have time to solve this tomorrow...)

$\endgroup$
  • $\begingroup$ While people have voted for this to be the answer, it doesn't handle the constrained case, which is the important one, as the marginal distribution of a multivariate normal is easy to get. $\endgroup$ – Shffl Mar 5 '17 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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