# Determining if samples fit a 3D Gaussian distribution

I have a collection of sample particles, with (x,y,z) coordinates generated by a simplified Monte Carlo-like code. I expect that these particles will follow an anisotropic diffusion process, which would give me a 3D Gaussian distribution with different variances along different axes (based on the geometry of the problem, I do expect the Gaussian to be axis-aligned; I suppose future development may generate a rotated 3D Gaussian, but I can deal with that generalization when and if it arises).

What I'm looking for is a way to:

1. Check that my data is consistent with a 3D Gaussian distribution (to confirm that diffusion is a good model);
2. Get the best-fit mean and variance (along each axis), with error if possible (to measure the drift velocity and the diffusion coefficients).

I thought about binning the data and doing a fit, but I'm not sure that's a great method. I was told to look into the Kolmogorov-Smirnov test, but that appears to be applicable to 1D distributions not 3D. Is there an accepted method for this sort of thing?

I generally work in C++, Fortran, or Python, so I'm hoping to avoid answers along the lines of "Matlab has a function to do that". If Python has a method, I can work with that. Otherwise, I don't mind coding up my own tool, but I don't know what algorithm to use.

• This sounds like a question for the statistics StackExchange. – user3883 May 13 '15 at 16:57
• You can consider creating histograms that you feed into a kernel density estimator. – AlexE Jul 31 '15 at 14:00