ksdensity doesn't return a pdf which sums to 1 and has problems at the boundary
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
dpb
il 14 Dic 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 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!