kfunc: estimate Ripley's K function

View source: R/kfunc.R

kfuncR Documentation

estimate Ripley's K function

Description

estimate the 1-d version of Ripley's K function

Usage

kfunc(
  x,
  d = seq(0, 100, by = 0.1),
  lengths = NULL,
  exclude = 0,
  tol = 0.000001
)

Arguments

x

list with sorted locations of the data

d

values at which to calculate the function

lengths

lengths of segments studied

exclude

distance to exclude

tol

tolerance value

Value

data frame with d, k, and se

See Also

gammacoi(), stahlcoi(), coincidence()

Examples

L <- 103
n <- 2000
map1 <- sim.map(L, n.mar=104, anchor=TRUE, include.x=FALSE, eq=TRUE)
x <- sim.cross(map1, n.ind=n, m=6, type="bc")

xoloc <- find.breaks(x)

d <- seq(0, 100, by=0.1)[-1]
kf <- kfunc(xoloc, d=d, lengths=rep(L, n))

plot(k ~ d, data=kf, type="n", yaxs="i", xaxs="i", las=1,
     ylim=c(0, max(kf$k + kf$se)))
polygon(c(kf$d, rev(kf$d)), c(kf$k + kf$se, rev(kf$k-kf$se)),
        border=NA, col="#add8e650")
lines(k ~ d, data=kf)


kbroman/xoi documentation built on May 1, 2023, 9:35 p.m.