ksdensity doesn't return a pdf which sums to 1 and has problems at the boundary
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm using ksdensity (with optimal bw) to estimate a pdf, but when I sum up the single entries I get 0.49. Shouldn't the sum be 1? Also, it returns zeros at the boundaries. How to correct for the zeros? Thank you.
0 commentaires
Réponses (1)
dpb
le 14 Déc 2015
Not necessarily, no. It'll depend on the range of the underlying estimated pdf covered in the input range of the data as well as you need to normalize the summation to produce an integral. Try the optional 'cdf' function with ksdensity; there's an example in the doc.
As an illustration, consider the following --
>> sum(normpdf(-1:0.01:1))/100
ans =
0.6851
>> sum(normpdf(-2:0.01:2))/100
ans =
0.9550
>>
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!