1. Home
  2. GRTHIN procedure

GRTHIN procedure

Randomly thins a spatial point pattern (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

OLDY = variates Vertical coordinates of each spatial point pattern; no default – this parameter must be set
OLDX = variates Horizontal coordinates of each spatial point pattern; no default – this parameter must be set
NPOINTS = scalars How many points to return from each pattern; no default – this parameter must be set
NEWY = variates Variates to receive the vertical coordinates of the randomly thinned patterns
NEWX = variates Variates to receive the horizontal coordinates of the randomly thinned patterns
SEED = scalars Seeds for the random numbers used to select the thinned points; default 0
THINNED = variates Variate whose values indicate whether the coordinates of each spatial point pattern are included (1) or excluded (0) from the thinned pattern

Description

This procedure randomly thins a spatial point pattern with coordinates specified by the parameters OLDX and OLDY. The number of points required in the thinned pattern is specified using the NPOINTS parameter which must be a positive integer. If NPOINTS is equal to or greater than the number of points in the original pattern then no points will be deleted. The coordinates of the points which remain after thinning can be saved using the parameters NEWX and NEWY. The SEED parameter allows a seed to be supplied for generating the random numbers used to select the thinned 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. The THINNED parameter can be used to save a logical variable containing the value 1 when a coordinate is used within the thinned pattern and 0 if the coordinate has not been selected in the thinned pattern.

Printed output is controlled by the PRINT option. The default setting of summary prints the horizontal and vertical coordinates of the points which remain after thinning under the headings NEWX and NEWY.

Option: PRINT.

Parameters: OLDY, OLDX, NPOINTS, NEWY, NEWX, SEED, THINNED.

Method

A procedure PTCHECKXY is called to check that OLDX and OLDY have identical restrictions. A dummy variate with the same number of elements as OLDX and OLDY and containing uniform random numbers in the interval (0,1) is created using the URAND function. The SORT function is then used to sort the elements of OLDX and OLDY into the order which would put the elements of the dummy variate in ascending order. Finally, the first NPOINTS elements of the sorted coordinates are transferred to the variates NEWX and NEWY using the EQUATE directive.

Action with RESTRICT

If OLDX and OLDY are restricted, only the subset of values specified by the restriction will be included in the calculations.

See also

Procedures: GRCSR, GRLABEL, GRTORSHIFT.

Commands for: Calculations and manipulation, Spatial statistics.

Example

CAPTION 'GRTHIN 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  :
GRTHIN  OLDY=piney; OLDX=pinex; NPOINTS=10; SEED=519352
Updated on March 7, 2019

Was this article helpful?