Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a random distribution of points in the $x\!-\!y$ plane. I can obtain a graphical representation of the probability distribution function using SmoothHistogram3D. Now I need to use this in another calculation. To do this I need a function that approximates SmoothHistogram3D.

Could you please tell me how to do it?

share|improve this question
Look up SmoothKernelDistribution[]. – J. M. Apr 26 '13 at 17:33
That was a brilliant suggestion J.M. I am over the moon. I tested it with NIntegrate by generating a PDF and it worked superbly. All the best. Eitan – Eitan Abraham Apr 26 '13 at 19:49
@J.M. this should be an answer – Vitaliy Kaurov Apr 26 '13 at 20:03

At Vitaliy's behest:

You want the distribution SmoothKernelDistribution[], which can be treated like any other distribution by feeding it into PDF[], CDF[]...

Here's a comparison for reference:

BlockRandom[SeedRandom[197, Method -> "MersenneTwister"]; (* for reproducibility *)
            data = RandomVariate[BinormalDistribution[.75], 25]];

dist = SmoothKernelDistribution[data, "StandardGaussian", "Gaussian"];
{DensityPlot[PDF[dist, {x, y}], {x, -3.5, 3.8}, {y, -3.9, 4.2}, Mesh -> Automatic,
             MeshFunctions -> {#3 &}], 
 SmoothDensityHistogram[data, {"StandardGaussian", "Gaussian"}, "PDF"]} // GraphicsRow

smooth histogram comparison

share|improve this answer
I appreciate that you include the bandwidth and kernel to show how they map from one function to the other. – Brett Champion Apr 27 '13 at 2:42
I take the extra mile whenever feasible... :) – J. M. Apr 27 '13 at 2:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.