[R] Ripley's K function within envelope--how to change the maximum distance?

adrian at maths.uwa.edu.au adrian at maths.uwa.edu.au
Thu Mar 6 03:20:40 CET 2008


Steve Markofsky <s.markofsky at ucl.ac.uk> writes:

> I'm trying to run a Ripley's K analysis on a point pattern
> within a window of 1 square km.
> The maximum distance I want to use is the diagonal
> of the window, around 1400m, run in 50m increments.

You can't estimate K(r) for r equal to the diagonal of the window,
as there is no data at this distance.

The Ripley isotropic correction is only valid for r values that are less
than HALF the diagonal, which would be 707m.

Because of the high variability of the estimate when r is large, the usual
recommended maximum distance for estimating K(r) is half the length of the
shortest side of the rectangle, so that would be 500m. Ripley's own
recommendation is to restrict it to one QUARTER of the shortest side
length, or 250m.

You ask how to do this in the package 'spatstat' in the context of a
simulation envelope.

> ERip<-envelope(EforRip,fun=Kest,r=seq(0,1400,50),correction=c
> ("Ripley"),nsim=99,rank=1,transform=expression(sqrt(./
> pi)),global=TRUE)

If you replace 1400 by something smaller, eg 500, then this code should
work. (Since you're using the L function, you could also replace 'Kest' by
'Lest' and then remove the 'transform' argument).

The result 'ERip' is an fv object (function value table). By default,
plot(ERip) will restrict the r values to the recommended range [0,250].
But you can plot them over a larger range by plot(ERip, xlim=c(0,500)).

Adrian Baddeley



More information about the R-help mailing list