Skip to content
Prev 12870 / 29559 Next

kernel density estimation - scaling factor problem?

(1) You make an awfully complicated issue of the calculations.
Why not just:

require(spatstat)
W <- owin(c(0,10),c(0,10))
X <- ppp(x=c(2,7,4,5,8,8,1,3,3,9),
                y=c(6,5,1,1,4,5,7,1,9,8),
                marks=c(10,7,5,9,12,14,8,11,7,10),
                window=W)
ddd <- density(X,sigma=1.4,weights=marks(X),edge=FALSE)

Doing range(ddd$v) gives

[1] 0.008501562 2.454624379

so the highest density is about 2.45.

(2) Why do you say that 2.4 is too small?  You have a total of 93
apples over 100 square metres, giving a mean density of 0.93.
So 2.4 as a maximum density seems commensurate with this.

(3) The integral of ddd is a bit on the small side; 77.01386.  This
seems to be due to your peculiar insistence on no edge correction.

(4) Your value of sigma may be a tad large; if we let density() choose
sigma for itself we get 1.25.

(5) Doing

     eee <- density(X,weights=marks(X),diggle=TRUE)

yields an integral of exactly 93 and a maximal density of about 3.128.

Does that make you happier?

     cheers,

         Rolf Turner
On 21/09/11 09:43, Myles Falconer wrote: