PTKERNEL2D procedure

Performs kernel smoothing of a spatial point pattern (M.A. Mugglestone, S.A. Harding, B.Y.Y. Lee, P.J. Diggle & B.S. Rowlingson).


Option

PRINT = strings
What to print (grid, monitoring); default grid, moni


Parameters

Y = variates
Vertical coordinates of each spatial point pattern; no default - this parameter must be set

X = variates
Horizontal coordinates of each spatial point pattern; 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

HZERO = scalars
What kernel width to use for each pattern; no default - this parameter must be set

NY = scalars
Numbers of rows to use in the grid of kernel density estimates; default 20

NX = scalars
Numbers of columns to use in the grid of kernel density estimates; default 20

YGRID = variates
Variates to receive the vertical coordinates at which each kernel function has been evaluated

XGRID = variates
Variates to receive the horizontal coordinates at which each kernel function has been evaluated

ZGRID = matrices
Matrices of dimension NY by NX to receive the grid of density estimates


Description

This procedure performs kernel smoothing of a spatial point pattern using the methods of Diggle (1985) and Berman & Diggle (1989). The kernel density estimate at a point (x, y) represents the intensity of events at that location, and is denoted by kde(x, y). The method implemented in GSplancs uses a quartic kernel function, whereby

kde(x, y) = ∑i ( (1 - distancei / (2 × H0) )2 ),

where the summation is over all the events in the pattern, distancei is the distance from event i to the point (x, y), and H0 specifies the kernel width. Increasing the value of H0 produces smoother density estimates.

   The data required by the procedure are the coordinates of the points in the pattern (specified using the parameters X and Y) and the coordinates of a polygon within which smoothing is to be performed (specified using the parameters XPOLYGON and YPOLYGON). The kernel width must be specified using the parameter HZERO. The procedure calculates kernel density estimates at a grid of points spanning the specified polygon. The parameters NX and NY specify the numbers of columns and rows to be used in the grid; the default value for both parameters is 20. The output of the procedure is a matrix of kernel density estimates; any elements of the matrix which correspond to points outside the specified polygon will be returned as missing values.

   The ZGRID parameter can save the kernel density estimates as a matrix with NY rows and NX columns, with the columns corresponding to values of the horizontal coordinate (x) arranged in ascending order, and the columns corresponding to values of the vertical coordinate (y) in ascending order. (So, for example, if these are plotted using DSURFACE or DSHADE, the YORIENTATION option should be left with its default setting of reverse to reverse the y-coordinates.)

   Printed output is controlled using the PRINT option. The settings available are monitoring (which prints details about the parameter settings for the kernel smoothing process) and grid (which prints the grid of kernel density estimates).

 

Option: PRINT.

Parameters: Y, X, YPOLYGON, XPOLYGON, HZERO, NY, NX, YGRID, XGRID, ZGRID.


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 procedure then calls PTCLOSEPOLYGON to close the polygon specified by XPOLYGON and YPOLYGON. It then calls a procedure PTPASS to call a Fortran program to calculate edge-corrected kernel density estimates for the grid of points spanning the polygon. Finally, the MVINSERT function is used to replace estimates for grid points which lie outside the polygon by missing values.


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.


References

Berman, M. & Diggle, P.J. (1989). Estimating weighted integrals of the second-order intensity of a spatial point process. Journal of the Royal Statistical Society, Series B, 51, 81-92.

Diggle, P.J. (1985). A kernel method for smoothing point process data. Applied Statistics, 34, 138-147.