Generates completely spatially random points in a polygon (M.A. Mugglestone, S.A. Harding, B.Y.Y. Lee, P.J. Diggle & B.S. Rowlingson).
|What to print (
||Vertical coordinates of each polygon; no default – this parameter must be set|
||Horizontal coordinates of each polygon; no default – this parameter must be set|
||How many points to generate in each polygon; no default – this parameter must be set|
||Variates to receive the vertical coordinates of the points that have been generated|
||Variates to receive the horizontal coordinates of the points that have been generated|
||Seeds for the random numbers used to generate the points; default 0|
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 (see Diggle 1983). This procedure generates a simulated realization of CSR in a given polygon. The coordinates of the polygon are specified using the parameters
YPOLYGON. The number of points to be generated is specified using the parameter
NPOINTS. The coordinates of the points which are generated may be saved using the parameters
SEED parameter allows a seed to be supplied for generating the random numbers used to generate the points (thereby producing reproducible results). If this is not supplied, the default of 0 initializes the random number generator (if necessary) from the system clock.
Print output is controlled using the
summary prints the horizontal and vertical coordinates of the points which are generated under the headings
PTCHECKXY is called to check that
YPOLYGON have identical restrictions. The parameters
NPOINTS are then passed to a sub-procedure called
GRCSR_GENPTS. The sub-procedure generates points randomly in the bounding box of the polygon specified by
YPOLYGON using the
URAND function. It then calls
PTSINPOLYGON to exclude any points which lie outside the polygon. If the number of points retained is less than
GRCSR_GENPTS is called again recursively until at least
NPOINTS points have been generated. Finally, the
EQUATE directive is used to transfer the coordinates of the first
NPOINTS points generated by
GRCSR_GENPTS to the parameters
YPOLYGON are restricted, only the subset of values specified by the restriction will be included in the calculations.
Diggle, P.J. (1983). Statistical Analysis of Spatial Point Patterns. Academic Press, London.
CAPTION 'GRCSR example'; STYLE=meta VARIATE xhexagon; VALUES=!(0.3,0.0,0.3,0.7,1.0,0.7) & yhexagon; VALUES=!(0.0,0.5,1.0,1.0,0.5,0.0) GRCSR [PRINT=*] YPOLYGON=yhexagon; XPOLYGON=xhexagon; NPOINTS=50;\ YCSR=ycsr; XCSR=xcsr DPTMAP [YLOWER=0; YUPPER=1; XLOWER=0; XUPPER=1] Y=ycsr; X=xcsr DPOLYGON [SCREEN=keep] YPOLYGON=yhexagon; XPOLYGON=xhexagon; PEN=2