# How to plot Intensity of SmoothKernelDistribution?

For example, we have a list of values

data = RandomVariate[NormalDistribution[], 10^3];


then

SmoothHistogram[data]


By default plot the PDF of data like this But there is also options to plot the Intensity of data using

SmoothHistogram[data, Automatic, "Intensity"]


which gives This intensity curve is what I want. But I also want the function of this intensity curve, so I can to subtract two such intensity curve function to plot a new one.

I look into the doc, it seems that SmoothKernelDistribution suite the needs. For example, let

dist=SmoothKernelDistribution[data]


then

Plot[PDF[dist, {x}], {x, -3, 3}]


gives Which is equivalent to SmoothHistogram[data]. But how to get equivalent Intensity plot using SmoothKernelDistribution? Is there a complete list of function that is supported by SmoothKernelDistribution like PDF?

Clear["Global*"]

SeedRandom;
data = RandomVariate[NormalDistribution[], 10^3];

{xmin, xmax} = MinMax@data;

smhist = SmoothHistogram[data, Automatic, "Intensity"] p[x_] = PDF[SmoothKernelDistribution[data], x];


The factor required to scale the PDF to the intensity curve is

amp = Divide @@
((Cases[#, Line[pts_] :> pts, Infinity][[1, All, 2]] //
Max) & /@
{smhist, Plot[p[x], {x, xmin, xmax}]});

intensity[x_] = amp*p[x];

Plot[intensity[x], {x, xmin, xmax}] EDIT: A more straightforward approach is to use the points from smhist to define an InterpolatingFunction.

int = Interpolation[Cases[smhist, Line[pts_] :> pts, Infinity][]];

Plot[int[x], {x, xmin, xmax}]
` • Wow, powerful postprocessing. So there is no built in statistic function corresponding to "indensity"? – matheorem Apr 23 '19 at 0:05