1. Home
  2. KHAT procedure

KHAT procedure

Calculates an estimate of the K function (M.A. Mugglestone, S.A. Harding, B.Y.Y. Lee, P.J. Diggle & B.S. Rowlingson).

Option

PRINT = string token What to print (summary); default summ

Parameters

Y = variates Vertical coordinates of each spatial point pattern; no default – this parameter must be set
X = variates Horizontal coordinates of each spatial point pattern; no default – this parameter must be set
YPOLYGON = variates Vertical coordinates of each polygon; no default – this parameter must be set
XPOLYGON = variates Horizontal coordinates of each polygon; no default – this parameter must be set
S = variates Vectors of distances to use; no default – this parameter must be set
KVALUES = variates Variates to receive the estimated values of the K function

Description

The K function, or reduced second-order moment function, relates to the distribution of the inter-event distances between all ordered pairs of events in a spatial point pattern (see Diggle 1983). The function is formally defined as the expected number of further events within distance s of an arbitrary event, divided by the overall density of events per unit area. An approximately unbiased estimator of K which incorporates corrections for edge effects can be obtained using the method of Ripley (1976). This estimator, denoted by K^(s), is essentially an empirical distribution function (EDF) of weighted inter-event distances. The weight associated with an inter-event distance s derived from events at positions (x1, y1) and (x2, y2) is the reciprocal of the conditional probability that any event separated from the point (x1, y1) by the distance s will fall in the study region and so be observed.

The term complete spatial randomness (CSR) is used to represent the hypothesis that the overall density of events in a spatial point pattern is constant throughout the study region, and that the events are distributed independently and uniformly. Under CSR, the expected number of further events which lie within a distance s of an arbitrary event in the pattern is simply the area of a circle of radius s, multiplied by the overall density of events. Thus, the K function for a completely random pattern is given by

K(s) = π × s2 .

The K function for a clustered (regular) pattern will tend to be larger (smaller) than the values given by the above expression, at least for small distances.

The procedure KHAT calculates Ripley’s (1976) estimator for K given the coordinates of a spatial point pattern (specified by the parameters X and Y), the coordinates of a polygon containing the points (specified by the parameters XPOLYGON and YPOLYGON) and a vector of distances at which to calculate the EDF of K (specified by the parameter S). The output of the procedure is a vector of estimates of K corresponding to the distances in S. The estimated K function can be saved using the parameter KVALUES.

Printed output is controlled using the PRINT option. The default setting of summary prints the distances at which the K function is estimated and the estimates themselves under the headings S and KVALUES.

Option: PRINT.

Parameters: Y, X, YPOLYGON, XPOLYGON, S, KVALUES.

Method

A procedure PTCHECKXY is called to check that X and Y have identical restrictions. A similar check is made on XPOLYGON and YPOLYGON. The procedure then calls PTCLOSEPOLYGON to close the polygon specified by XPOLYGON and YPOLYGON. The SORT function is then used to create a variate containing the distances in S arranged in ascending order. (The original variate is left unchanged.) The procedure then calls a procedure PTPASS to call a Fortran program to calculate an edge-corrected estimate of the K function.

Action with RESTRICT

The variates X, Y, XPOLYGON, YPOLYGON and S may be restricted, as long as X has the same restriction as Y, and XPOLYGON has the same restriction as YPOLYGON. Only the subset of values specified by each restriction will be included in the calculations.

References

Diggle, P.J. (1983). Statistical Analysis of Spatial Point Patterns. Academic Press, London.

Ripley, B.D. (1976). The second-order analysis of stationary point processes. Journal of Applied Probability, 13, 255-266.

See also

Procedures: FHAT, GHAT, KCSRENVELOPES, KLABENVELOPES, KSED, KSTHAT, KSTSE, K12HAT.

Commands for: Spatial statistics.

Example

CAPTION   'KHAT example'; STYLE=meta
VARIATE   pinex,piney
READ      [SETNVALUES=yes] pinex,piney
 0.09 0.91   0.02 0.71   0.03 0.62   0.18 0.61   0.03 0.52
 0.02 0.41   0.16 0.35   0.13 0.33   0.13 0.27   0.03 0.21
 0.13 0.14   0.08 0.11   0.02 0.02   0.18 0.98   0.31 0.89
 0.22 0.58   0.13 0.52   0.21 0.38   0.23 0.27   0.23 0.11
 0.41 0.98   0.44 0.97   0.42 0.93   0.42 0.48   0.43 0.36
 0.59 0.92   0.63 0.92   0.63 0.88   0.66 0.88   0.58 0.83
 0.53 0.69   0.52 0.68   0.49 0.58   0.52 0.48   0.52 0.09
 0.58 0.06   0.68 0.66   0.68 0.63   0.67 0.53   0.67 0.48
 0.67 0.41   0.68 0.34   0.66 0.24   0.73 0.27   0.74 0.11
 0.78 0.06   0.79 0.02   0.86 0.03   0.84 0.88   0.94 0.89
 0.95 0.83   0.79 0.79   0.84 0.71   0.83 0.68   0.86 0.65
 0.79 0.61   0.93 0.48   0.83 0.42   0.93 0.31   0.93 0.23
 0.97 0.64   0.96 0.64   0.96 0.61   0.96 0.57   0.97 0.38  :
VARIATE   xpoly; VALUES=!(0,1,1,0)
&         ypoly; VALUES=!(0,0,1,1)
&         s; VALUES=!(0.01,0.02...0.1)
KHAT      [PRINT=*] Y=piney; X=pinex; YPOLYGON=ypoly; XPOLYGON=xpoly;\ 
          S=s; KVALUES=kpines
CALCULATE kcsr = CONSTANTS('pi')*(s**2)
PRINT     s,kpines,kcsr
Updated on March 7, 2019

Was this article helpful?