Kest(X, ..., r=NULL, breaks=NULL, 
     correction=c("border", "isotropic", "Ripley", "translate"),
    nlarge=3000, domain=NULL)"ppp", or data
    in any format acceptable to as.ppp().r.
    Not normally invoked by the user. See the Details section."none", "border", "bord.modif",
    "isotropic", "Ripley" or "translate".
    It specifies the edge corrnlarge, then only the
    border correction will be computed, using a fast algorithm."fv", see fv.object,
  which can be plotted directly using plot.fv.Essentially a data frame containing columns
"border", "bord.modif",
  "iso" and/or "trans",
  according to the selected edge corrections. These columns contain
  estimates of the function $K(r)$ obtained by the edge corrections
  named.Kest estimates the $K$ function
  of a stationary point process, given observation of the process
  inside a known, bounded window. 
  The argument X is interpreted as a point pattern object 
  (of class "ppp", see ppp.object) and can
  be supplied in any of the formats recognised by
  as.ppp().  The estimation of $K$ is hampered by edge effects arising from 
  the unobservability of points of the random pattern outside the window. 
  An edge correction is needed to reduce bias (Baddeley, 1998; Ripley, 1988). 
  The corrections implemented here are
  [object Object],[object Object],[object Object]
  For instructional purposes, you can also set
  correction="none" to compute an estimate of the $K$
  function without edge correction. This estimate is biased and should
  not be used for data analysis.
  The estimates of $K(r)$ are of the form
  $$\hat K(r) = \frac a {(n-1) \pi} \sum_i \sum_j I(d_{ij}\le r) e_{ij}$$
  where $a$ is the area of the window, $n$ is the number of
  data points, and the sum is taken over all ordered pairs of points
  $i$ and $j$ in X.
  Here $d_{ij}$ is the distance between the two points,
  and $I(d_{ij} \le r)$ is the indicator
  that equals 1 if the distance is less than or equal to $r$.
  The term $e_{ij}$ is the edge correction weight (which
  depends on the choice of edge correction listed above).
  Note that this estimator assumes the process is stationary (spatially
  homogeneous). For inhomogeneous point patterns, see
  Kinhom.
  If the point pattern X contains more than about 3000 points,
  the isotropic and translation edge corrections can be computationally
  prohibitive. The computations for the border method are much faster,
  and are statistically efficient when there are large numbers of
  points. Accordingly, if the number of points in X exceeds
  the threshold nlarge, then only the border correction will be
  computed. Setting nlarge=Inf will prevent this from happening.
  Setting nlarge=0 is equivalent to selecting only the border
  correction with correction="border".
  If the argument domain is given, the calculations will
  be restricted to a subset of the data. In the formula for $K(r)$ above,
  the first point $i$ will be restricted to lie inside
  domain. The result is an approximately unbiased estimate
  of $K(r)$ based on pairs of points in which the first point lies
  inside domain and the second point is unrestricted.
  This is useful in bootstrap techniques. The argument domain
  should be a window (object of class "owin") or something acceptable to
  as.owin. It must be a subset of the
  window of the point pattern X.
  The estimator Kest ignores marks.
  Its counterparts for multitype point patterns
  are Kcross, Kdot,
  and for general marked point patterns
  see Kmulti. 
  Some writers, particularly Stoyan (1994, 1995) advocate the use of
  the ``pair correlation function''
  $$g(r) = \frac{K'(r)}{2\pi r}$$
  where $K'(r)$ is the derivative of $K(r)$.
  See pcf on how to estimate this function.
Diggle, P.J. Statistical analysis of spatial point patterns. Academic Press, 1983.
Ohser, J. (1983) On estimators for the reduced second moment measure of point processes. Mathematische Operationsforschung und Statistik, series Statistics, 14, 63 -- 71. Ripley, B.D. Statistical inference for spatial processes. Cambridge University Press, 1988.
Stoyan, D, Kendall, W.S. and Mecke, J. (1995) Stochastic geometry and its applications. 2nd edition. Springer Verlag.
Stoyan, D. and Stoyan, H. (1994) Fractals, random shapes and point fields: methods of geometrical statistics. John Wiley and Sons.
localK to extract individual summands in the $K$
  function.  pcf for the pair correlation.
  Fest,
  Gest,
  Jest
  for alternative summary functions.
  
  Kcross,
  Kdot,
  Kinhom,
  Kmulti for counterparts of the $K$ function
  for multitype point patterns.
  
  reduced.sample for the calculation of reduced sample
  estimators.
pp <- runifpoint(50)
 K <- Kest(pp)
 data(cells)
 K <- Kest(cells, correction="isotropic")
 plot(K)
 plot(K, main="K function for cells")
 # plot the L function
 plot(K, sqrt(iso/pi) ~ r)
 plot(K, sqrt(./pi) ~ r, ylab="L(r)", main="L function for cells")Run the code above in your browser using DataLab