# Why are Binormal and Multinormal giving me different results when I use NExpectation?

fixed in 10.1 (windows)

Binormal and Multinormal can both be used to represent normal random variables:

S = {{2, 0.5}, {0.5, 1}};
Covariance[BinormalDistribution[{0, 0}, {Sqrt[2], 1}, 0.5/Sqrt[2]]]
Covariance[MultinormalDistribution[{0, 0}, S]]
Mean[BinormalDistribution[{0, 0}, {Sqrt[2], 1}, 0.5/Sqrt[2]]]
Mean[MultinormalDistribution[{0, 0}, S]]

Results in

{{2, 0.5}, {0.5, 1}}
{{2, 0.5}, {0.5, 1}}
{0, 0}
{0, 0}

But,

NExpectation[x*y, {x, y} \[Distributed] BinormalDistribution[{0, 0}, {Sqrt[2], 1}, 0.5/Sqrt[2]]]
NExpectation[x*y, {x, y} \[Distributed] MultinormalDistribution[{0, 0}, S]]

yields

0.5
0.25

What am I missing?

• I get 0.5 and 0.5 (Mathematica 10.0.0, Windows 8.1) Did S accidentally get redefined before your second evaluation? Mar 15, 2015 at 19:38
• I double-checked, but no. I opened a new notebook and ran only the code I posted, along with << NumericalCalculus I'm running Linux. Is it possible to have differences between platforms? Mar 15, 2015 at 19:41
• I get 0.5 and 0.25 using v10.0.2 on a Mac; however. Expectation rather than NExpectation gives 0.5 for both distributions. Mar 15, 2015 at 20:07
• I get .5 for both , mma 9.0.1
– ciao
Mar 15, 2015 at 20:27
• I can confirm that on win8.1 MMA 8.04, 9 and 10.0.2 yield {0.5,0.5}, {0.5,0.5} and {0.5,0.25}, respectively. Looks like a bug introduced in v10 after 10.0.0. Could you report this to [email protected]? Mar 15, 2015 at 22:07

In version 10.0.2 Mathematica is using an incorrect standardization rule

StatisticsLibraryStandardizationRules[{x, y},
MultinormalDistribution[{0, 0}, {{2, 0.5}, {0.5, 1}}]]
{{x -> x/Sqrt[2], y -> y},
MultinormalDistribution[{0, 0}, {{1, 0.353553}, {0.353553, 1}}]}

This is incorrect as

Expectation[(x y)/Sqrt[2],
{x, y} \[Distributed] MultinormalDistribution[{0, 0}, {{1, 0.35355339059327373}, {0.35355339059327373, 1}}]]

0.25

shows.

The nonnumerical expectation

Expectation[x*y, {x, y} \[Distributed] MultinormalDistribution[{0, 0}, S]]

0.5

gives a correct result.

Using the option Method -> "MonteCarlo" gives a correct approximation

NExpectation[x*y, {x, y} \[Distributed] MultinormalDistribution[{0, 0}, S],
Method -> "MonteCarlo"]

0.498123

Using NIntegrate directly gives a correct result

NIntegrate[
x*y PDF[MultinormalDistribution[{0, 0}, S], {x, y}],
{x, -Infinity, Infinity}, {y, -Infinity, Infinity}]

0.5

Symbolic:

StatisticsLibrary`StandardizationRules[{x, y},
MultinormalDistribution[{0, 0}, {{s11, s12}, {s21, s22}}]]
{{x -> x/Sqrt[s11], y -> y/Sqrt[s22]},
MultinormalDistribution[{0, 0},
{{1, 1/2 (s12/(Sqrt[s11] Sqrt[s22]) + s21/(Sqrt[s11] Sqrt[s22]))},
{1/2 (s12/(Sqrt[s11] Sqrt[s22]) + s21/(Sqrt[s11] Sqrt[s22])), 1}}]}
Expectation[
x/Sqrt[s11]*y/Sqrt[s22],
{x, y} \[Distributed] MultinormalDistribution[{0, 0},
{{1, 1/2 (s12/(Sqrt[s11] Sqrt[s22]) + s21/(Sqrt[s11] Sqrt[s22]))},
{1/2 (s12/(Sqrt[s11] Sqrt[s22]) + s21/(Sqrt[s11] Sqrt[s22])), 1}}]]

(s12 + s21)/(2 s11 s22)

But

Expectation[
x*y,
{x, y} \[Distributed] MultinormalDistribution[{0, 0}, {{s11, s12}, {s21, s22}}]]

s21

Fixed in 10.1 (windows)

code

S = {{2, 0.5}, {0.5, 1}};
Covariance[BinormalDistribution[{0, 0}, {Sqrt[2], 1}, 0.5/Sqrt[2]]];
Covariance[MultinormalDistribution[{0, 0}, S]];
Mean[BinormalDistribution[{0, 0}, {Sqrt[2], 1}, 0.5/Sqrt[2]]];
Mean[MultinormalDistribution[{0, 0}, S]];
NExpectation[x*y, {x, y} \[Distributed] BinormalDistribution[{0, 0}, {Sqrt[2], 1}, 0.5/Sqrt[2]]]
NExpectation[x*y, {x, y} \[Distributed] MultinormalDistribution[{0, 0}, S]]