KSdensity peaks
이전 댓글 표시
Hi,
How could I retrieve the peaks for a density estimation and also how to choose the threshold for it?
Thank you, A.
답변 (1개)
the cyclist
2011년 3월 25일
There is a function KSDENSITY that will do kernel density estimation. A good start would be reading the help file:
help ksdensity
which also has a couple examples.
You can get the peaks by using the function MAX on the output. I don't think I can concisely explain how to choose a threshold. Maybe the Wikipedia article on kernel density estimation could get you started there?
댓글 수: 4
Devinya Herath
2011년 10월 5일
Do you know any way to find the data point(xi) corresponding to the peak (s)?
the cyclist
2011년 10월 5일
Call
[f,xi] = ksdensity(x);
then
[max_f index_to_max] = max(f);
finds the maxima and
xi(index_to_max)
gives the xi coordinates of the maxima.
Devinya Herath
2011년 10월 6일
Yes. It gives Just one maximum value. If, for a given bandwidth (the 'width' parameter of the ksdensity function)h, there exists multiple peaks,how can we extract the corresponding data points (xi)? Do you have any idea?
the cyclist
2011년 10월 6일
If you know how many peaks you are looking for, you could use the sort() function to put the "f" values in order, and find the indices. If you do not know how many peaks you are looking for, then you could use the diff() function to find values that are larger than either of the values next to it.
카테고리
도움말 센터 및 File Exchange에서 Kernel Distribution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!