Randomly labels two or more spatial point patterns (M.A. Mugglestone, S.A. Harding, B.Y.Y. Lee, P.J. Diggle & B.S. Rowlingson).

### Options

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

`SEED` = scalar |
Seed for the random numbers used to create the random labellings; default 0 |

### Parameters

`OLDY` = variates |
Vertical coordinates of two or more spatial point patterns; no default – this parameter must be set |
---|---|

`OLDX` = variates |
Horizontal coordinates of two or more spatial point patterns; no default – this parameter must be set |

`NEWY` = variates |
Variates to receive the vertical coordinates of the spatial point patterns created by random labelling |

`NEWX` = variates |
Variates to receive the horizontal coordinates of the spatial point patterns created by random labelling |

### Description

This procedure pools the coordinates of two or more spatial point patterns (specified using the `OLDX`

and `OLDY`

parameters) and randomly groups (or labels) the points to form *n* new patterns, where *n* is the number of patterns supplied using `OLDX`

and `OLDY`

. Each new pattern contains the same number of points as its old counterpart. The coordinates of the new patterns can be saved using the parameters `NEWX`

and `NEWY`

. The `SEED`

option allows a seed to be supplied for generating the random numbers used to create 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.

Printed output is controlled using the `PRINT`

option. The default setting of summary prints the coordinates of each randomly labelled pattern under the headings `NEWX[i]`

and `NEWY[i]`

, (`i`

= 1 … *n*).

Options: `PRINT`

, `SEED`

.

Parameters: `OLDY`

, `OLDX`

, `NEWY`

, `NEWX`

.

### Method

A procedure `PTCHECKXY`

is called to check that each pair of structures in `OLDX`

and `OLDY`

have identical restrictions. The procedure `APPEND`

is then used to create a single variate containing the horizontal coordinates of all the point patterns and a factor whose levels indicate the source (original label) of the points. The vertical coordinates are combined in a similar way. The `URAND`

and `SORT`

functions are then used to randomly permute the labels. Finally, the `RESTRICT`

directive is used to extract the horizontal and vertical coordinates corresponding to each level of the permuted factor.

### Action with `RESTRICT`

If any of the variates in `OLDX`

and `OLDY`

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

### See also

Procedures: `GRCSR`

, `GRTHIN`

, `GRTORSHIFT`

.

Commands for: Calculations and manipulation, Spatial statistics.

### Example

CAPTION 'GRLABEL example'; STYLE=meta VARIATE xcross; VALUES=!( 4, 5, 6, 6, 6, 6, 7, 8) & ycross; VALUES=!(16,16,14,15,17,18,16,16) & xcircle; VALUES=!(14,14,15,15,16,16,17,17) & ycircle; VALUES=!(10,11, 9,12, 9,12,10,11) GRLABEL [PRINT=*; SEED=841641] OLDY=ycross,ycircle; OLDX=xcross,xcircle;\ NEWY=rly1,rly2; NEWX=rlx1,rlx2 DPTMAP [YLOWER=0; YUPPER=20; XLOWER=0; XUPPER=20]\ Y=rly1,rly2; X=rlx1,rlx2