Calculates an estimate of the F nearest-neighbour distribution function (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

`Y1` = variates |
Vertical coordinates of the first spatial point patterns; no default – this parameter must be set |
---|---|

`X1` = variates |
Horizontal coordinates of the first spatial point patterns; no default – this parameter must be set |

`Y2` = variates |
Vertical coordinates of the second spatial point patterns; no default – this parameter must be set |

`X2` = variates |
Horizontal coordinates of the second spatial point patterns; no default – this parameter must be set |

`S` = variates |
Vectors of distances to use; no default – this parameter must be set |

`FVALUES` = variates |
Variates to receive the estimated F nearest-neighbour distribution functions |

`NNDISTANCES` = variates |
Variates to receive the nearest-neighbour distances |

### Description

The F nearest-neighbour distribution function relates to the distribution of distances from each of a set of sample points covering the region of interest to the nearest event of an observed spatial point pattern (see Diggle 1983). Other names for this function are the point-nearest event distribution function and the empty-space distribution function. An estimate of F can be obtained by generating a grid of points (for example, using the `PTGRID`

procedure) and then calculating the empirical distribution function (EDF) FHAT(s) which is defined as the proportion of grid points for which the nearest event in the observed pattern is within distance *s*. The larger the number of grid points used, the better the approximation to the true distribution, F. For preliminary analysis, Diggle (1983) recommends using the same number of grid points as there are events in the observed pattern.

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. Under CSR, the F nearest-neighbour distribution function is given by

F(*s*) = 1 – exp(-π × *density* × (*s*^{2})),

where *density* is the overall density of events per unit area. (The procedure `FZERO`

can be used to calculate values of this function for a pattern with a given density.) The F nearest-neighbour distribution function for a clustered (regular) pattern will tend to be smaller (larger) than the corresponding function for a completely random pattern, at least for small distances.

`FHAT`

requires the coordinates of an observed spatial point pattern (specified by the parameters `X1`

and `Y1`

), the coordinates of a set of sample points (specified by the parameters `X2`

and `Y2`

), and a vector of distances at which to calculate the EDF of F (specified by the parameter `S`

). The primary output of the procedure is a vector of estimates of F corresponding to the distances in `S`

. The estimated F function can be saved using the parameter `FVALUES`

. The nearest-neighbour distances can be saved using the parameter `NNDISTANCES`

.

Printed output is controlled using the `PRINT`

option. The default setting of `summary`

prints the distances at which the F function is estimated and the estimates themselves under the headings `S`

and `FVALUES`

.

Option: `PRINT`

.

Parameters: `Y1`

, `X1`

, `Y2`

, `X2`

, `S`

, `FVALUES`

, `NNDISTANCES`

.

### Method

A procedure `PTCHECKXY`

is called to check that `X1`

and `Y1`

have identical restrictions. A similar check is made on `X2`

and `Y2`

. The procedure then calls a procedure `PTPASS`

to call a Fortran program to calculate the F nearest-neighbour distances. No corrections are made for edge effects. The EDF of the nearest-neighbour distances relative to the distances specified by the parameter `S`

is obtained using the `CALCULATE`

directive.

### Action with `RESTRICT`

The variates `X1`

, `Y1`

, `X2`

, `Y2`

, and `S`

may be restricted, as long as `X1`

has the same restriction as `Y1`

, and `X2`

has the same restriction as `Y2`

. Only the subset of values specified by each restriction will be included in the calculations.

### Reference

Diggle, P.J. (1983). *Statistical Analysis of Spatial Point Patterns*. Academic Press, London.

### See also

Procedures: `FZERO`

, `GHAT`

, `KHAT`

, `KSTHAT`

, `K12HAT`

.

Commands for: Spatial statistics.

### Example

CAPTION 'FHAT 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 : VARIATE xpoly; VALUES=!(0,1,1,0) & ypoly; VALUES=!(0,0,1,1) CALCULATE ngrid = 10*NVALUES(pinex) PTGRID [PRINT=*] YPOLYGON=ypoly; XPOLYGON=xpoly; NPOINTS=ngrid;\ YGRID=ygrid; XGRID=xgrid VARIATE s; VALUES=!(0.01,0.02...0.1) FHAT [PRINT=*] Y1=piney; X1=pinex; Y2=ygrid; X2=xgrid; S=s;\ FVALUES=fpines PTINTENSITY [PRINT=*] Y=piney; X=pinex; YPOLYGON=ypoly; XPOLYGON=xpoly;\ DENSITY=density FZERO [PRINT=*] DENSITY=density; S=s; FVALUES=fcsr PRINT s,fpines,fcsr