Estimates the locally-rescaled \(K\)-function of a point process.
Kscaled(X, lambda=NULL, …, r = NULL, breaks = NULL,
    rmax = 2.5, 
    correction=c("border", "isotropic", "translate"),
    renormalise=FALSE, normpower=1,
    sigma=NULL, varcov=NULL)  Lscaled(…)
The observed data point pattern,
    from which an estimate of the locally scaled \(K\) function
    will be computed.
    An object of class "ppp"
    or in a format recognised by as.ppp().
Optional.
    Values of the estimated intensity function.
    Either a vector giving the intensity values
    at the points of the pattern X,
    a pixel image (object of class "im") giving the
    intensity values at all locations, a function(x,y) which
    can be evaluated to give the intensity value at any location,
    or a fitted point process model (object of class "ppm").
Arguments passed from Lscaled to Kscaled
    and from Kscaled to density.ppp
    if lambda is omitted.
vector of values for the argument \(r\) at which the locally scaled \(K\) function should be evaluated. (These are rescaled distances.) Not normally given by the user; there is a sensible default.
This argument is for internal use only.
maximum value of the argument \(r\) that should be used. (This is the rescaled distance).
A character vector containing any selection of the
    options "border", 
    "isotropic", "Ripley",
    "translate", "translation",
    "none" or "best".
    It specifies the edge correction(s) to be applied.
    Alternatively correction="all" selects all options.
Logical. Whether to renormalise the estimate. See Details.
Integer (usually either 1 or 2). Normalisation power. See Details.
Optional arguments passed to  density.ppp
    to control the smoothing bandwidth, when lambda is
    estimated by kernel smoothing.
An object of class "fv" (see fv.object).
Essentially a data frame containing at least the following columns,
the vector of values of the argument \(r\) at which the pair correlation function \(g(r)\) has been estimated
vector of values of \(\pi r^2\), the theoretical value of \(K_{\rm scaled}(r)\) for an inhomogeneous Poisson process
Kscaled computes an estimate of the \(K\) function
  for a locally scaled point process.
  Lscaled computes the corresponding \(L\) function
  \(L(r) = \sqrt{K(r)/\pi}\).
Locally scaled point processes are a class of models for inhomogeneous point patterns, introduced by Hahn et al (2003). They include inhomogeneous Poisson processes, and many other models.
The template \(K\) function of a locally-scaled process is a counterpart of the ``ordinary'' Ripley \(K\) function, in which the distances between points of the process are measured on a spatially-varying scale (such that the locally rescaled process has unit intensity).
The template \(K\) function is an indicator of interaction between the points. For an inhomogeneous Poisson process, the theoretical template \(K\) function is approximately equal to \(K(r) = \pi r^2\). Values \(K_{\rm scaled}(r) > \pi r^2\) are suggestive of clustering.
Kscaled computes an estimate of the template \(K\) function
  and Lscaled computes the corresponding \(L\) function
  \(L(r) = \sqrt{K(r)/\pi}\).
The locally scaled interpoint distances are computed using an approximation proposed by Hahn (2007). The Euclidean distance between two points is multiplied by the average of the square roots of the intensity values at the two points.
The argument lambda should supply the
  (estimated) values of the intensity function \(\lambda\).
  It may be either
containing the values
      of the intensity function at the points of the pattern X.
(object of class "im")
      assumed to contain the values of the intensity function
      at all locations in the window.
which can be evaluated to give values of the intensity at any locations.
if lambda is omitted, then it will be estimated using
      a `leave-one-out' kernel smoother.
If lambda is a numeric vector, then its length should
  be equal to the number of points in the pattern X.
  The value lambda[i] is assumed to be the 
  the (estimated) value of the intensity
  \(\lambda(x_i)\) for
  the point \(x_i\) of the pattern \(X\).
  Each value must be a positive number; NA's are not allowed.
If lambda is a pixel image, the domain of the image should
  cover the entire window of the point pattern. If it does not (which
  may occur near the boundary because of discretisation error),
  then the missing pixel values 
  will be obtained by applying a Gaussian blur to lambda using
  blur, then looking up the values of this blurred image
  for the missing locations. 
  (A warning will be issued in this case.)
If lambda is a function, then it will be evaluated in the
  form lambda(x,y) where x and y are vectors
  of coordinates of the points of X. It should return a numeric
  vector with length equal to the number of points in X.
If lambda is omitted, then it will be estimated using
  a `leave-one-out' kernel smoother,
  as described in Baddeley, Moller
  and Waagepetersen (2000).  The estimate lambda[i] for the
  point X[i] is computed by removing X[i] from the
  point pattern, applying kernel smoothing to the remaining points using
  density.ppp, and evaluating the smoothed intensity
  at the point X[i]. The smoothing kernel bandwidth is controlled
  by the arguments sigma and varcov, which are passed to
  density.ppp along with any extra arguments.
If renormalise=TRUE, the estimated intensity lambda
  is multiplied by \(c^(normpower/2)\) before performing other calculations,
  where \(c = area(W)/sum[i] (1/lambda(x[i]))\). This 
  renormalisation has about the same effect as in Kinhom,
  reducing the variability and bias of the estimate
  in small samples and in cases of very strong inhomogeneity.
Edge corrections are used to correct bias in the estimation
  of \(K_{\rm scaled}\). First the interpoint distances are 
  rescaled, and then edge corrections are applied as in Kest.
  See Kest for details of the edge corrections
  and the options for the argument correction.
The pair correlation function can also be applied to the
  result of Kscaled; see pcf and pcf.fv.
Baddeley, A., Moller, J. and Waagepetersen, R. (2000) Non- and semiparametric estimation of interaction in inhomogeneous point patterns. Statistica Neerlandica 54, 329--350.
Hahn, U. (2007) Global and Local Scaling in the Statistics of Spatial Point Processes. Habilitationsschrift, Universitaet Augsburg.
Hahn, U., Jensen, E.B.V., van Lieshout, M.N.M. and Nielsen, L.S. (2003) Inhomogeneous spatial point processes by location-dependent scaling. Advances in Applied Probability 35, 319--336.
Prokesova, M., Hahn, U. and Vedel Jensen, E.B. (2006) Statistics for locally scaled point patterns. In A. Baddeley, P. Gregori, J. Mateu, R. Stoica and D. Stoyan (eds.) Case Studies in Spatial Point Pattern Modelling. Lecture Notes in Statistics 185. New York: Springer Verlag. Pages 99--123.
# NOT RUN {
  data(bronzefilter)
  X <- unmark(bronzefilter)
  K <- Kscaled(X)
  fit <- ppm(X, ~x)
  lam <- predict(fit)
  K <- Kscaled(X, lam)
# }
Run the code above in your browser using DataLab