1. Home
  2. KLABENVELOPES procedure

KLABENVELOPES procedure

Gives bounds for K function differences under random labelling (M.A. Mugglestone, S.A. Harding, B.Y.Y. Lee, P.J. Diggle & B.S. Rowlingson).

Options

PRINT = string tokens What to print (summary, monitoring); default summ, moni

Parameters

Y1 = variates Vertical coordinates of the first spatial point patterns; no default – this parameter must be set
X1 = variates Horizontal coordinates of the first spatial point patterns; no default – this parameter must be set
Y2 = variates Vertical coordinates of the second spatial point patterns; no default – this parameter must be set
X2 = variates Horizontal coordinates of the second spatial point patterns; 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
NSIMULATIONS = scalars How many simulations of random labelling to use; no default – this parameter must be set
S = variates Vectors of distances to use; no default – this parameter must be set
KLOWER = variates Variates to receive the values of the lower bound of the difference between the K functions
KUPPER = variates Variates to receive the values of the upper bound of the difference between the K functions
SEED = scalars Seeds for the random numbers used to generate the random labellings; default 0

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 procedure KHAT can be used to obtain an approximately unbiased estimator of K(s) for an observed pattern, and this may be used to investigate the degree of clustering/regularity in the pattern. Patterns consisting of two different types of events may be separated into two patterns, one for each type of event. The difference between the K functions for the two univariate patterns may then be used to investigate whether the two types of events display similar degrees of clustering/regularity. (If the difference between the K functions is positive (negative) then the first pattern is more (less) strongly clustered than the second.)

The term random labelling is used to represent the hypothesis that the spatial distributions of different types of events within an overall pattern are completely random. Under random labelling, the difference between the K functions for different types of events is zero (Diggle & Chetwynd 1991). Critical values for the estimated difference between two K functions under random labelling may be obtained by repeatedly simulating from the null hypothesis, for example using the procedure GRLABEL. If NSIMULATIONS denotes the number of simulations used, then, for each value of s, the mimimum (maximum) value of the difference between the two K functions provides an approximate 100/(NSIMULATIONS+1) percent lower (upper) critical value for the true difference.

The procedure KLABENVELOPES computes lower and upper bounds (envelopes) for the difference between two K functions under random labelling. The data required by the procedure are the coordinates of two spatial point patterns (specified by the parameters X1, Y1, X2 and Y2), the coordinates of a polygon containing the points (specified by the parameters XPOLYGON and YPOLYGON), the number of simulations to use (specified by the parameter NSIMULATIONS) and a vector of distances at which to estimate the K functions (specified by the parameter S). The SEED parameter allows a seed to be supplied for generating the random numbers required to generate the random labelling (thereby producing reproducible results). If this is not supplied, the default of 0 initializes the random number generator (if necessary) from the system clock. The output of the procedure consists of two vectors, the first containing the minimum value obtained for the difference between the K functions for each distance in S (calculated by subtracting the K function for the second pattern from that of the first pattern), and the second containing the corresponding maximum values. The minimum and maximum values of the difference between the two K functions can be saved using the parameters KLOWER and KUPPER.

Printed output is controlled using the PRINT option. The settings available are monitoring (which prints a message to mark the start of each simulation) and summary (which prints the distances at which the K functions are estimated under the heading S, together with the lower and upper bounds for the difference between the K functions under the headings KLOWER and KUPPER).

Option: PRINT.

Parameters: Y1, X1, Y2, X2, YPOLYGON, XPOLYGON, NSIMULATIONS, S, KLOWER, KUPPER, SEED.

Method

A procedure PTCHECKXY is called to check that X1 and Y1 have identical restrictions. Similar checks are made on X2 and Y2, and 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 procedures GRLABEL and KHAT are then called NSIMULATIONS times to calculate estimates of the difference between the K functions for the two types of events under random labelling. Finally the VMINIMA and VMAXIMA functions are used to calculate the minimum and maximum values of the difference between the two K functions for each distance in S.

Action with RESTRICT

The variates X1, Y1, X2, Y2, XPOLYGON, YPOLYGON and S may be restricted as long as X1 has the same restriction as Y1, X2 has the same restriction as Y2 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.

Diggle, P.J. & Chetwynd, A.G. (1991). Second-order analysis of spatial clustering. Biometrics, 47, 1155-1163.

See also

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

Commands for: Spatial statistics.

Example

CAPTION   'KLABENVELOPES example'; STYLE=meta
VARIATE   pykx,pyky
READ      [SETNVALUES=yes] pykx,pyky
0.077 0.045 0.324 0.008 0.332 0.018 0.354 0.008 0.366 0.008
0.534 0.057 0.561 0.045 0.648 0.059 0.739 0.020 0.943 0.047
0.012 0.170 0.326 0.134 0.344 0.154 0.715 0.178 0.852 0.138
0.887 0.162 0.905 0.107 0.136 0.237 0.156 0.235 0.273 0.277
0.312 0.253 0.504 0.257 0.682 0.275 0.779 0.241 0.923 0.257
0.040 0.322 0.073 0.372 0.308 0.391 0.338 0.362 0.514 0.316
0.652 0.310 0.664 0.310 0.763 0.322 0.779 0.340 0.834 0.352
0.259 0.407 0.514 0.431 0.670 0.443 0.709 0.470 0.802 0.472
0.899 0.455 0.138 0.522 0.202 0.575 0.265 0.516 0.308 0.545
0.352 0.601 0.451 0.545 0.518 0.549 0.585 0.561 0.680 0.557
0.729 0.573 0.729 0.545 0.109 0.656 0.130 0.640 0.630 0.686
0.638 0.646 0.638 0.636 0.725 0.664 0.889 0.609 0.073 0.791
0.245 0.743 0.458 0.787 0.484 0.751 0.696 0.747 0.747 0.713
0.909 0.745 0.945 0.771 0.132 0.838 0.277 0.818 0.350 0.814
0.385 0.881 0.739 0.808 0.765 0.893 0.909 0.804 0.970 0.877
0.364 0.980 0.980 0.913 :
VARIATE   metx,mety
READ      [SETNVALUES=yes] metx,mety
0.024 0.071 0.043 0.030 0.103 0.097 0.107 0.057 0.130 0.099
0.132 0.059 0.166 0.026 0.166 0.012 0.285 0.051 0.204 0.063
0.036 0.119 0.047 0.146 0.081 0.168 0.190 0.128 0.202 0.138
0.213 0.115 0.227 0.174 0.269 0.182 0.008 0.241 0.036 0.292
0.043 0.283 0.059 0.213 0.245 0.294 0.257 0.209 0.261 0.263
0.294 0.213 0.385 0.206 0.411 0.245 0.431 0.213 0.455 0.237
0.490 0.285 0.431 0.020 0.455 0.457 0.468 0.099 0.480 0.012
0.486 0.083 0.502 0.047 0.431 0.154 0.478 0.132 0.504 0.126
0.504 0.113 0.536 0.107 0.565 0.146 0.609 0.119 0.617 0.154
0.636 0.158 0.672 0.164 0.727 0.119 0.763 0.172 0.771 0.182
0.775 0.170 0.818 0.125 0.840 0.119 0.840 0.099 0.921 0.136
0.982 0.154 0.543 0.026 0.601 0.073 0.648 0.028 0.666 0.040
0.779 0.047 0.842 0.008 0.852 0.047 0.949 0.032 0.581 0.267
0.672 0.217 0.706 0.219 0.763 0.300 0.767 0.209 0.779 0.225
0.818 0.209 0.838 0.296 0.885 0.219 0.949 0.241 0.014 0.328
0.051 0.368 0.057 0.356 0.154 0.308 0.178 0.322 0.285 0.374
0.356 0.375 0.482 0.314 0.530 0.350 0.585 0.316 0.648 0.352
0.660 0.342 0.704 0.381 0.739 0.330 0.846 0.383 0.850 0.308
0.917 0.308 0.921 0.346 0.974 0.348 0.974 0.312 0.990 0.332
0.036 0.470 0.036 0.421 0.103 0.466 0.144 0.494 0.170 0.439
0.575 0.455 0.595 0.415 0.652 0.474 0.751 0.502 0.773 0.486
0.838 0.427 0.858 0.482 0.889 0.494 0.931 0.427 0.931 0.403
0.937 0.417 0.972 0.419 0.051 0.534 0.065 0.589 0.083 0.573
0.117 0.553 0.237 0.557 0.243 0.542 0.259 0.593 0.302 0.579
0.302 0.551 0.304 0.601 0.320 0.589 0.326 0.532 0.368 0.518
0.431 0.551 0.462 0.514 0.500 0.542 0.551 0.530 0.652 0.585
0.662 0.577 0.767 0.545 0.806 0.597 0.826 0.538 0.874 0.549
0.006 0.668 0.028 0.648 0.233 0.636 0.304 0.656 0.405 0.652
0.425 0.680 0.435 0.648 0.510 0.644 0.534 0.670 0.634 0.609
0.656 0.640 0.672 0.652 0.727 0.613 0.931 0.656 0.968 0.623
0.022 0.708 0.063 0.787 0.103 0.711 0.273 0.715 0.324 0.757
0.346 0.709 0.375 0.800 0.381 0.773 0.435 0.777 0.437 0.745
0.557 0.771 0.595 0.708 0.652 0.747 0.822 0.759 0.850 0.794
0.885 0.785 0.953 0.763 0.004 0.879 0.020 0.854 0.071 0.874
0.109 0.800 0.113 0.822 0.134 0.822 0.152 0.834 0.162 0.877
0.202 0.810 0.225 0.852 0.257 0.806 0.300 0.850 0.328 0.806
0.356 0.903 0.409 0.875 0.437 0.905 0.447 0.852 0.455 0.842
0.488 0.850 0.510 0.905 0.526 0.854 0.557 0.087 0.617 0.846
0.642 0.858 0.652 0.814 0.751 0.893 0.820 0.822 0.862 0.820
0.903 0.899 0.907 0.854 0.923 0.834 0.043 0.913 0.051 0.990
0.089 0.970 0.089 0.931 0.164 0.933 0.184 0.937 0.204 0.929
0.249 0.964 0.281 0.935 0.281 0.921 0.287 0.988 0.411 0.945
0.449 0.929 0.494 0.931 0.508 0.998 0.518 0.929 0.542 0.992
0.648 0.980 0.711 0.951 0.755 0.925 0.830 0.986 0.858 0.949
0.273 0.427 0.356 0.427 0.494 0.409 0.561 0.500 0.939 0.992
0.460 0.036 :
VARIATE   xpoly; VALUES=!(0,1,1,0)
&         ypoly; VALUES=!(0,0,1,1)
&         s; VALUES=!(0.01,0.02...0.1)
KHAT      [PRINT=*] Y=pyky; X=pykx; YPOLYGON=ypoly; XPOLYGON=xpoly;\ 
          S=s; KVALUES=kpyknotic
KHAT      [PRINT=*] Y=mety; X=metx; YPOLYGON=ypoly; XPOLYGON=xpoly;\ 
          S=s; KVALUES=kmetaphase
CALCULATE kdiff = kpyknotic - kmetaphase
KLABENVELOPES [PRINT=monitoring] Y1=pyky; X1=pykx;\ 
          Y2=mety; X2=metx; YPOLYGON=ypoly; XPOLYGON=xpoly;\ 
          NSIMULATIONS=19; S=s; KLOWER=minrlab; KUPPER=maxrlab; SEED=653861
PRINT     s,kdiff,minrlab,maxrlab
Updated on March 7, 2019

Was this article helpful?