Skip to main content

probability or statistics - Calculating the Mean of a Truncated Multinormal Distribution


First, I'm a little disappointed that Mathematica balks at:


Mean[TruncatedDistribution[{{0, Infinity}},MultinormalDistribution[{0}, {{1}}]]]

Second, is the numerical computation of means from truncated multinormal distributions so hard? Is anyone aware of a package that implements the algorithm of Leppard and Tallis (1989) (see here for FORTRAN code) or anything like it?


Edit: rm asked for an example that fails to compute:


Mean[TruncatedDistribution[{{0, Infinity}, {0, Infinity}},
MultinormalDistribution[{0.5, 1.5}, {{1., 0.3}, {0.3, 1.}}]]]


Answer



If you want to do serious statistical work, I would suggest to not use Mean and instead use specialized functions that work on distributions, such as Expectation and NExpectation. Although the documentation says that Mean[dist] gives the mean of the symbolic distribution, I suspect they meant it for basic distributions such as NormalDistribution, BinomialDistribution, etc., which were all there when Mean was written. Mean was last modified in version 6 and most probably is not aware of newer functions such as TruncatedDistribution, MultinormalDistribution, etc., which were all introduced in version 8.


So the equivalent code for your example is:


NExpectation[{x, y}, {x, y} \[Distributed] 
TruncatedDistribution[
{{0, Infinity}, {0, Infinity}},
MultinormalDistribution[{0.5, 1.5}, {{1., 0.3}, {0.3, 1.}}]
]
]
(* {1.02198, 1.74957} *)


Using Expectation offers more flexibility than Mean, because you can now calculate the expectations of arbitrary quantities:


NExpectation[{Sin[x], y^3}, {x, y} \[Distributed] 
TruncatedDistribution[
{{0, Infinity}, {0, Infinity}},
MultinormalDistribution[{0.5, 1.5}, {{1., 0.3}, {0.3, 1.}}]
]
]
(* {0.650673, 9.70065} *)


NExpectation still does not work with MultinormalDistribution with a single dimension... I don't know why exactly, but personally I would never use a Multi-something function to mean just 1 (which is the opposite of multi). I would suggest using a Switch and use NormalDistribution when you have a MultinormalDistribution of dimension 1.


Comments