Ksphere: Estimate of Spherical K Function

View source: R/Ksphere.R

KsphereR Documentation

Estimate of Spherical K Function

Description

Given a point pattern on the sphere, or on a region of the sphere, compute an estimate of the K-function.

Usage

  Ksphere(X, win=sphwin(), r,
          correction=c("un", "iso", "rs", "rsm"),
          ratio=FALSE, lambdavalues=NULL, update=TRUE)

Arguments

X

The observed point pattern, from which an estimate of K(r) will be computed. An object of class sp2 or sp3, or a 2 or 3 column matrix giving the locations of points in spherical coordinates.

win

The window; an object of type sphwin. Only required if X is an object of class matrix.

r

Optional. Numeric vector. The values of the argument r at which K(r) should be evaluated.

correction

Character string or character vector specifying the choice of edge corrections.

ratio

Logical value specifying whether to store information about the numerator and denominator of the estimator, for use by other functions.

lambdavalues

Optional. If this argument is given, the inhomogeneous K function is computed. Either a numeric vector containing estimates of the intensity at each data point, or a fitted point process model (object of class "sphppm") which predicts the intensity.

update

Logical value indicating, when lambdavalues is a fitted point process model, whether to re-fit the model to the point pattern X before extracting the fitted intensity values.

Details

If lambdavalues=NULL, this computes the homogeneous K function for a point pattern on the sphere, analogous to that for R^2 proposed by Ripley (1976).

If lambdavalues!=NULL, this computes a generalisation of the K function for inhomogeneous point patterns, analagous to that proposed by Baddeley, Moller and Waagepetersen (2000).

The homogeneous or Ripley's K function (variously known as the "reduced second-order moment function" and "Ripley's K function" of a stationary point process X is defined so that lambda K(r) equals the expected number of additional random points within a distance r of a typical random point of X. Here lambda is the intensity of the process, i.e. the expected number of points of X per unit area. The K function is determined by the second order moment properties of X.

An estimate of K derived from a spatial point pattern dataset can be used in exploratory data analysis and formal inference about the pattern (Cressie, 1991; Diggle, 1983; Ripley, 1977, 1988). In exploratory analyses, the estimate of K is a useful statistic summarising aspects of inter-point "dependence" and "clustering". For inferential purposes, the estimate of K is usually compared to the true value of K for a completely random (Poisson) point process, which is

K(r) = 2 * pi * rho^2 * (1 - cos(r/rho))

where rho is the radius of the sphere on which X is observed. Deviations between the empirical and theoretical K curves may suggest spatial clustering or spatial regularity.

Provided that lambdavalues=NULL, this routine Ksphere estimates the K function of a homogeneous point process, given observation of the process inside a window that is a sphere, cap, band, band complement, wedge, or polygon where all boundaries are great circle arcs. The argument X is interpreted as a point pattern object (of class "sp2" or "sp3"; or of class "matrix" with 2 or 3 columns giving the coordinates of points, and accompanied by an object of class "sphwin" giving the observation window).

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

rs, rsm the border and modified border methods or "reduced sample" estimators (see Ripley, 1988). These is the least efficient (statistically) and the fastest to compute.

iso The analogue of Ripley's isotropic correction (see Ripley, 1988; Ohser, 1983). This is implemented for caps, bands, band complements, wedges and polygons where all boundaries are great circle arcs.

un Uncorrected estimate. An estimate of the K function without edge correction. (i.e. setting e[i,j] = 1 in the equation below. Unless the window is a sphere, this estimate is biased and should not be used for data analysis, unless you have an extremely large point pattern (more than 100,000 points).

The estimates of K(r) are of the form

Khom(r) = (a/(n * (n-1))) * sum[i,j] I(d[i,j] <= r) e[i,j])

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[i,j] is the distance between the two points, and I(d[i,j] <= r) is the indicator that equals 1 if the distance is less than or equal to r. The term e[i,j] is the edge correction weight (which depends on the choice of edge correction listed above).

The inhomogeneous K function Kinhom(r) is a direct generalisation to nonstationary point processes. Suppose x is a point process with non-constant intensity lambda(u) at each location u. Define Kinhom(r) to be the expected value, given that u is a point of x, of the sum of all terms 1/lambda(x[j]) over all points x[j] in the process separated from u by a distance less than r. This reduces to the ordinary K function if lambda() is constant. If x is an inhomogeneous Poisson process with intensity function lambda(u), then Kinhom(r) = 2 * pi * rho^2 * (1-cos(r))

Given a point pattern dataset, the inhomogeneous K function can be estimated essentially by summing the values 1/(lambda(x[i]) * lambda(x[j])) for all pairs of points (x[i],x[j]) separated by a distance less than r.

This allows us to inspect a point pattern for evidence of interpoint interactions after allowing for spatial inhomogeneity of the pattern. Values Kinhom(r) > 2 * pi * rho^2 * (1-cos(r/ρ)) are suggestive of clustering.

The argument lambdavalues should supply the (estimated) values of the intensity function lambda. It may be either a numeric vector containing the values of the intensity function at the points of the pattern X. a fitted point process model (object of class "sphppm") whose fitted trend can be used as the fitted intensity.

If lambdavalues 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.

Edge corrections are used to correct bias in the estimation of K. Each edge-corrected estimate of K(r) is of the form

Kinhom(r) = sum_i sum_j 1(d[i,j] <= r) * e(x[i],x[j],r)/(lambda(x[i]) * lambda(x[j]))

where d[i,j] is the minimum great circle distance between points x[i] and x[j], and e(x[i],x[j],r) is an edge correction factor. The only available correction is the 'isotropic' correction, for which

e(x[i],x[j],r) = 1/(area(W) g(x[i],x[j]))

where g(x[i],x[j]) is the fraction of the circumference of the circle with centre x[i] and radius d(x[i],x[j]) which lies inside the window.

Value

An object of class "fv", see fv.object, which can be plotted directly using plot.fv.

Note

This function is the analogue for point processes on the sphere of the functions Kest and Kinhom in spatstat, which is the corresponding function for point processes in R^2. Hence elements of the code for Ksphere and help page have been taken from Kest and Kinhom with the permission of A. J. Baddeley. This enables the code to be highly efficient and give corresponding output to, and for the information on this help page to be consistent with that for the functions Kest and Kinhom. It is hoped that this will minimise or remove any confusion for users of both spatstat and spherstat.

Author(s)

Tom Lawrence.

References

Baddeley, A.J. Spatial sampling and censoring. In O.E. Barndorff-Nielsen, W.S. Kendall and M.N.M. van Lieshout (eds) Stochastic Geometry: Likelihood and Computation. Chapman and Hall, 1998. Chapter 2, pages 37–78.

Baddeley, A., Moller, J. and Waagepetersen, R. (2000) Non- and semiparametric estimation of interaction in inhomogeneous point patterns. Statistica Neerlandica 54, 329–350.

Cressie, N.A.C. Statistics for spatial data. John Wiley and Sons, 1991.

Diggle, P.J. Statistical analysis of spatial point patterns. Academic Press, 1983.

Lawrence, T. (2017) Master's Thesis, University of Western Australia.

Ohser, J. (1983) On estimators for the reduced second moment measure of point processes. Mathematische Operationsforschung und Statistik, series Statistics, 14, 63 – 71.

Ohser, J. and Stoyan, D. (1981) On the second-order and orientation analysis of planar stationary point processes. Biometrical Journal 23, 523–533.

Raskin, R.G. (1994) Spatial analysis on the sphere: a review (94-7) NGCIA technical report (Available from http://eprints.cdlib.org/uc/item/5748n2xz). Accessed 4 November 2015.

Ripley, B.D. (1977) Modelling spatial patterns (with discussion). Journal of the Royal Statistical Society, Series B, 39, 172 – 212.

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.

See Also

Fsphere, Gsphere, Jsphere, Kest, Kinhom

Examples

   win <- sphwin()
   X <- runif.sphwin(100, win)
   rv <- seq(0, pi/2, length=512)
   K <- Ksphere(X, win, rv)
   K
   plot(K)

   sphcap <- sphwin(type="band", param=c(0, pi/3), ref=c(0,0))
   Xcap <- runif.sphwin(100, sphcap)
   rv3 <- seq(0, pi/3, length=512)
   Kcap <- Ksphere(Xcap, r=rv3)
   plot(Kcap, xlim=c(0, pi/4))

   sphband <- sphwin(type="band", param=c(pi/3, 2*pi/3), ref=c(0,0))
   Xb <- runif.sphwin(100, sphband)
   Kb <- Ksphere(Xb, r=rv3)
   plot(Kb)

   sphbc <- sphwin(type="bandcomp", param=c(pi/3, 2*pi/3), ref=c(0,0))
   Xbc <- runif.sphwin(100, sphbc)
   Kbc <- Ksphere(Xbc, r=rv3)
   plot(Kbc)

baddstats/spherstat documentation built on Feb. 6, 2023, 1:45 a.m.