|
I was trying to find the bayes optimal error of a data set with multidimensional gaussian distribution. Someone told me that there is no closed form solution like the error function(erfc) for this generalization. And all we could do is a numerical approximation. My question is that since the distributions are known we should be able to calculate this analytically. Then getting to the mathematics I quickly realized that there exists no closed form solution for the integral of the general K dimensional Gaussian... So how might one evaluate this numerically? |
|
You could use an existing numerical integration package. Here's example of numerically integrating p(x)||x|| in Mathematica, where p(x) is d-dimensional Gaussian. Needs["MultivariateStatistics`"]
(*Compute E[||X||] for d-dimensional Gaussian*)
ev[d_] :=
Module[{ndist, params, pdf, intlimits, norm},
ndist = MultinormalDistribution[Table[0, {d}], IdentityMatrix[d]];
params = (Subscript[x, #1] &) /@ Table[i, {i, 1, d}];
pdf = PDF[ndist, params];
intlimits =
Sequence @@ ({Subscript[x, #1], -Infinity, Infinity} &) /@
Table[i, {i, 1, d}];
norm = Sqrt[Plus @@ (#1^2 &) /@ params];
NIntegrate[norm*pdf, Evaluate[intlimits], Method -> LocalAdaptive]];
ev[3]
For Bayes optimal error, you'll probably need to integrate over a region defined implicitly, here's how to do that |