Hi everyone,

I am trying to do (nd in the best case, at least 2d) kernel density estimation.

I think this library can help me. I will be glad if someone enlightens me on how to use this functionality.

How can I implement the KDE functionality for 2d estimation?

# Kernel Density Estimation for 2 dimension

I canâ€™t help with the 2D case, but I can give you an example of a 1D case.

```
// create sample of 100 observations of Normal distribution with mean = 5.0 and sigma = 1.0
double[] s = new double[100];
Normal N = new Normal(5.0, 1.0, new Random());
N.Samples(s);
double h = 0.5; // bandwidth
for (double x = 2.0; x <= 8.0; x += 0.5)
{
var kd = KernelDensity.EstimateGaussian(x, h, s); // estimate PDF at x
Console.WriteLine(x.ToString("###.00")+" "+kd.ToString("##0.00"));
}
```

Output is the estimated PDF:

```
2.00 0.01
2.50 0.03
3.00 0.09
3.50 0.20
4.00 0.29
4.50 0.32
5.00 0.32
5.50 0.27
6.00 0.20
6.50 0.14
7.00 0.08
7.50 0.03
8.00 0.01
```