Fit Kernel Distribution to Data with Boundary Condition
3 ビュー (過去 30 日間)
古いコメントを表示
I need to fit a distribution to a data set I created and decided on a kernel density distribution. For this I use
fitdist(data,'Kernel','Kernel','epanechnikov');
My data set has only values greater than zero. Unfortunately, my current implementation of the kernel fit ignores that boundary condition. From literature and also this great youtube video I know that it is possible to create a kernel distribution that respects such a boundary condition by using a mirroring method.
Is there a possibility within the fitdist function or by some other method to easily implement this boundary condition?
0 件のコメント
採用された回答
the cyclist
2021 年 3 月 8 日
I would do this by using the ksdensity function. Specifically, see this section about using the reflection boundary condition.
Here is an example, distilled from that documentation:
rng('default') % For reproducibility
% Create some data
pd = makedist('HalfNormal','mu',0,'sigma',1);
x = random(pd,50,1);
pts = linspace(0,5,1000); % points to evaluate the estimator
[f,xi] = ksdensity(x,pts,'Support','positive','BoundaryCorrection','reflection');
figure
hold on
plot(x,zeros(numel(x),1),'.')
plot(xi,f)
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!