Why is the following integration involving multivariate Gaussian distribution so slow and generating an error? Is there a better integration strategy? All that I'm doing is considering $(X_1,X_2,X_3,X_4) \sim N(\mu, \Sigma)$ and computing the (trivial expectation) $E[1]$, which obviously equals to $1$.
muvec = ConstantArray[0.1, 4];
sigmat = IdentityMatrix[4];
npdf[x_] := PDF[MultinormalDistribution[muvec, sigmat], x];
NIntegrate[ 1 * npdf[{x1, x2, x3, x4}],
{x1, -Infinity, Infinity},
{x2, -Infinity, Infinity},
{x3, -Infinity, Infinity},
{x4, -Infinity, Infinity} ] // AbsoluteTiming
This results in the errors
NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small. >>
NIntegrate::eincr: The global error of the strategy GlobalAdaptive has increased more than 2000 times. The global error is expected to decrease monotonically after a number of integrand evaluations. Suspect one of the following: the working precision is insufficient for the specified precision goal; the integrand is highly oscillatory or it is not a (piecewise) smooth function; or the true value of the integral is 0. Increasing the value of the GlobalAdaptive option MaxErrorIncreases might lead to a convergent numerical integration. NIntegrate obtained 1.000000567592556` and 0.000021505642234874004` for the integral and error estimates. >>
and the result
{12.521, 1.}
The result is correct, but it has taken far too long (in my opinion), and moreover, I'm a little bit puzzled by the error message (despite reading http://reference.wolfram.com/language/tutorial/NIntegrateIntegrationStrategies.html), and I've tried other integration methods and it's still relatively slow.
In the actual application I have in mind, I want to consider $h(y) := E[ g(y;X_1,X_2,X_3,X_4)] $, where $g$ is somewhat complex and I need to use the expression $h(y)$ over and over again, and hence if I can't even compute $E[1]$ quickly and accurately, I have little hopes for computing the more difficult expectation.
Edit I emphasize that a symbolic integration of the solution is not of interest. In particular, since the question at hand is a "toy example", of which the real application is computing a more complex expectation $E[g(X_1,\ldots, X_n)]$ of which the function $g$ is sufficiently complex that there's no hope of a symbolic integral solution.