Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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[]. –  Guess who it is. 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

1 Answer 1

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... :) –  Guess who it is. 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.