Interpretation of Kernel Density

2 ビュー (過去 30 日間)
Trambak
Trambak 2013 年 4 月 9 日
Hello,
I have a question on the function ksdensity in MATLAB. We know that given X= x1,x2,x3,.xj..xN; the estimate of the pdf at xj is given by,
f(x=xj) = (1/Nb)sum_{i=1:N}[K((x-xi)/b)] for a simple gaussian kernel with bandwidth b.
My question is if I write f = ksdensity(X,X), then will f(j)=f(xj)? In other words, does ksdensity use the formula above? I am trying to implement the steps listed in section 2.3.1 of a paper (link below) and I am stuck at step iii, which brought me to ask this question. Any thoughts would be deeply appreciated.
Thanks Trambak

回答 (1 件)

Tom Lane
Tom Lane 2013 年 4 月 11 日
I suggest the best way to verify this is to write the equation that you expect and check that ksdensity does what you want.
According to my interpretation of what you want, ksdensity does what you ask. But your formula has the bandwidth b in it. You would have to provide that to ksdensity if you want to control it.
Also, your paper seems to talk about truncating the density to some interval (say [0,1]) and then dividing by the integral over that interval. I would expect that to yield a biased estimate. Points in the interior of the interval get their full kernel included. Points near the edge get only a part of their kernel included.
The ksdensity function uses a different method to account for finite support of the distribution. You may want to look more at that. I know there are different ways to approach it, but the function implements one of those approaches.

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by