如何将核平滑概率密度估计转换为 'stuff' 的单位

How to convert a kernel smoothed probability density estimate into units of 'stuff'

我目前正在研究多元概率分布(MATLAB 函数 mvksdensity),但我遇到了一个问题。

我有 space 中 [XYZ] 点的 3D PDF。我希望它以点为单位,比如每个箱子的估计点数,而不是概率。

这是因为我想估计在某些区域找到的点数,我想将 PDF 转换为时间(乘以 1/采样率),我想划分不同的不同数据的PDF等

我的第一个想法是将 PDF 除以其总和(因此 sum(PDF) = 1),然后乘以 [XYZ] 点的总数。这样总和(PDF)=点数,我应该能够完成上述所有操作。

基本上我的问题是如何将 PDF 转换成更像直方图的东西——这样单位是 'stuff' 而不是概率...

如有任何帮助,我们将不胜感激,

谢谢,

杆.

这是我的意思的玩具示例:

pos = rand(50000,3)*1000; % [XYZ] points
vindx = 0:50:1000; % grid over which we want to estimate KDE
[xv,yv,zv] = ndgrid(vindx); % grid over which we want to estimate KDE
f = mvksdensity(pos,[xv(:),yv(:),zv(:)],'Bandwidth',75,'Kernel','normal','Function','pdf'); % PDF
f = f./nansum(f(:)) .* length(pos(:,1)); % now the sum of f will = the number of [XYZ] points

map = NaN(length(vindx),length(vindx),length(vindx)); % prepare an empty 3D map
[~,idx] = ismember(xv(:),vindx); % get the indices along X
[~,idy] = ismember(yv(:),vindx); % get the indices along Y
[~,idz] = ismember(zv(:),vindx); % get the indices along Z
ida = sub2ind(size(map),idy,idx,idz); % get the indices into map
map(ida) = f(:); % add the values to map

figure % plot data
isosurface(map,nanmax(f(:))/2);
daspect([1 1 1])

mvksdensity表示的概率密度函数已经有了"fraction of the total population per unit volume of XYZ"的单位。乘以原始点数确实会将其转换为 "number of points from the original sample per unit volume of XYZ".

这些单位与直方图的单位基本相同,直方图的直方图具有 单位体积。如果一个元素输出要表示更大的 bin,则乘以 bin 的体积以表示预期落入该单位 bin 数量的点数。

在点网格上评估 mvksdensity 将留下一个值网格,这些值是核密度估计定义的 PDF 的数值近似值。将其乘以网格单元格体积(对于您的网格 ndgrid(vindx) 等于 50^3)产生的值在求和时形成 PDF 积分的 numerical approximation

PDF 在整个 XYZ 域上的解析积分 定义1。为了使您的值能够公平地反映 KDE 定义的 PDF,您不应该像在 f./nansum(f(:)) 示例中那样除以总和。如果数值积分nansum(f(:) * 50^3)不等于1,这反映了数值积分的逼近误差,要么说明网格延伸不够远,要么网格太粗。