1. Home
2. PTINTENSITY procedure

# PTINTENSITY procedure

Calculates the overall density for 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

`Y` = variates Vertical coordinates of each spatial point pattern; no default – this parameter must be set Horizontal coordinates of each spatial point pattern; no default – this parameter must be set Vertical coordinates of each polygon; no default – this parameter must be set Horizontal coordinates of each polygon; no default – this parameter must be set Scalars to receive the density of the spatial point patterns, i.e. the number of points per unit area

### Description

This procedure takes as input two variates containing the coordinates of a spatial point pattern (specified by the `X` and `Y` parameters) and the coordinates of a polygon containing the points (specified using the `XPOLYGON` and `YPOLYGON` parameters). The procedure returns the density of the spatial point pattern, which is defined to be the number of points per unit area. The density may be saved in a scalar specified by the parameter `DENSITY`.

Printed output is controlled by the `PRINT` option. The default setting of `summary` prints the density under the heading `DENSITY`.

Option: `PRINT`.

Parameters: `Y`, `X`, `YPOLYGON`, `XPOLYGON`, `DENSITY`.

### 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 area of the polygon is then calculated using `PTAREAPOLYGON` and then the density is calculated as the number of points divided by the area.

### Action with `RESTRICT`

If `X` and `Y` are restricted, only the subset of values specified by the restriction will be included in the calculations. `XPOLYGON` and `YPOLYGON` may also be restricted as long as the same restrictions apply to both parameters.

Procedure: `PTDESCRIBE`.

Commands for: Spatial statistics.

### Example

```CAPTION     'PTINTENSITY example'; STYLE=meta
VARIATE     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)
PTINTENSITY Y=piney; X=pinex; YPOLYGON=ypoly; XPOLYGON=xpoly
```
Updated on March 6, 2019