Hamid Ghorbani <hhamidghorbani at gmail.com> writes:
> In spatstat and for calculating the maximum absolute difference
> between the empirical Ripley's K-function (\hat(K), isotropic edge
> correction) and the theoretical K-function for a simulated Poisson
> process in a fixed window (suppose 3D case and fix number of points
> (n) in W), we usually use a sequence of regular grid points. On the
> other hand we know that the empirical K function is a step function
> and hence the max occurs only at a jump point. suppose x is a typical
> jump point (x is one of considered grid points), we have actually two
> differences at x because we should also consider the difference
> between \hat{K}(x-) and K(x-), where x- is the value just
> infinitesimally smaller than x. The problem is if we calculate the
> absolute difference only at the regular jump points like x, we shall
> underestimate the true unknown maximum absolute difference between
> \hat(K) and the theoretical K. How we can deal with this problem.
> Shall taking very fine grids points would solve the problem? If yes
> some word of theoretical reasoning please in direction of
> programming.
You want to calculate the maximum deviation M = \sup_r |\pi r^2 - \hat K(r)|.
In the spatstat package \hat K(r) is evaluated at a regular grid of
values of 'r'. If the spacing between two successive r values is r_{i+1} - r_i = s, then the discrete approximation M* = \max_i | \pi r_i^2 - \hat K(r_i)| satisfies
|M - M*| \le \pi (R^2 - (R-s)^2) = \pi (2 R s + s^2) where R is the maximum value of r over which the supremum is taken. One can thus control the accuracy of the computation by selecting a sufficiently fine grid spacing 's'.
Example
require(spatstat)
data(cells)
K <- Kest(cells, r = seq(0, 0.25, by=1e-06))
Mstar <- with(K, max(iso - theo))
maxerr <- pi * (2 * 0.25 * 1e-06 + 1e-12)
Prof Adrian Baddeley (UWA/CSIRO)
CSIRO Mathematics, Informatics & Statistics
Leeuwin Centre, 65 Brockway Road, Floreat WA 6014, Australia
Tel: 08 9333 6177 | Fax: 08 9333 6121 | Mob: 0410 447 821