# Spatstat package and Spatial point process: How to estimate the density when computing the inhomogeneous K-function?

http://www.inside-r.org/packages/cran/spatstat/docs/Kinhom

Here we see that to get the inhomogeneous K-function, we can either use a kernel density approximation method with small bandwidth to estimate the first-order density, or using a polynomial in x and y directions and estimate in a parametric way.

Which one is better at what kind of situation?

Thanks

• Well X <- unmark(spruces) has 134 points, and the intensity values of lam2 <- density(X, leaveoneout=FALSE, at="points") are 10-50% larger than lam <- density(X, leaveoneout=TRUE, at="points") so it does have some effect. You can also see a difference directly on plots of Kinhom in the two cases. Try plot(Kinhom(X, leaveoneout=FALSE), iso-theo~r) followed by plot(Kinhom(X), iso-theo~r, col = 2, add = TRUE) – Ege Rubak Oct 2 '15 at 20:13