# Ginhom

##### Inhomogeneous Nearest Neighbour Function

Estimates the inhomogeneous nearest neighbour function \(G\) of a non-stationary point pattern.

- Keywords
- spatial, nonparametric

##### Usage

```
Ginhom(X, lambda = NULL, lmin = NULL, ...,
sigma = NULL, varcov = NULL,
r = NULL, breaks = NULL, ratio = FALSE,
update = TRUE, warn.bias=TRUE, savelambda=FALSE)
```

##### Arguments

- X
The observed data point pattern, from which an estimate of the inhomogeneous \(G\) function will be computed. An object of class

`"ppp"`

or in a format recognised by`as.ppp()`

- lambda
Optional. Values of the estimated intensity function. Either a vector giving the intensity values at the points of the pattern

`X`

, a pixel image (object of class`"im"`

) giving the intensity values at all locations, a fitted point process model (object of class`"ppm"`

) or a`function(x,y)`

which can be evaluated to give the intensity value at any location.- lmin
Optional. The minimum possible value of the intensity over the spatial domain. A positive numerical value.

- sigma,varcov
Optional arguments passed to

`density.ppp`

to control the smoothing bandwidth, when`lambda`

is estimated by kernel smoothing.- …
Extra arguments passed to

`as.mask`

to control the pixel resolution, or passed to`density.ppp`

to control the smoothing bandwidth.- r
vector of values for the argument \(r\) at which the inhomogeneous \(K\) function should be evaluated. Not normally given by the user; there is a sensible default.

- breaks
This argument is for internal use only.

- ratio
Logical. If

`TRUE`

, the numerator and denominator of the estimate will also be saved, for use in analysing replicated point patterns.- update
Logical. If

`lambda`

is a fitted model (class`"ppm"`

or`"kppm"`

) and`update=TRUE`

(the default), the model will first be refitted to the data`X`

(using`update.ppm`

or`update.kppm`

) before the fitted intensity is computed. If`update=FALSE`

, the fitted intensity of the model will be computed without fitting it to`X`

.- warn.bias
Logical value specifying whether to issue a warning when the inhomogeneity correction factor takes extreme values, which can often lead to biased results. This usually occurs when insufficient smoothing is used to estimate the intensity.

- savelambda
Logical value specifying whether to save the values of

`lmin`

and`lambda`

as attributes of the result.

##### Details

This command computes estimates of the
inhomogeneous \(G\)-function (van Lieshout, 2010)
of a point pattern. It is the counterpart, for inhomogeneous
spatial point patterns, of the nearest-neighbour distance
distribution function \(G\)
for homogeneous point patterns computed by `Gest`

.

The argument `X`

should be a point pattern
(object of class `"ppp"`

).

The inhomogeneous \(G\) function is computed using the border correction, equation (7) in Van Lieshout (2010).

The argument `lambda`

should supply the
(estimated) values of the intensity function \(\lambda\)
of the point process. It may be either

- a numeric vector
containing the values of the intensity function at the points of the pattern

`X`

.- a pixel image
(object of class

`"im"`

) assumed to contain the values of the intensity function at all locations in the window.- a fitted point process model
(object of class

`"ppm"`

or`"kppm"`

) whose fitted*trend*can be used as the fitted intensity. (If`update=TRUE`

the model will first be refitted to the data`X`

before the trend is computed.)- a function
which can be evaluated to give values of the intensity at any locations.

- omitted:
if

`lambda`

is omitted, then it will be estimated using a `leave-one-out' kernel smoother.

If `lambda`

is a numeric vector, then its length should
be equal to the number of points in the pattern `X`

.
The value `lambda[i]`

is assumed to be the
the (estimated) value of the intensity
\(\lambda(x_i)\) for
the point \(x_i\) of the pattern \(X\).
Each value must be a positive number; `NA`

's are not allowed.

If `lambda`

is a pixel image, the domain of the image should
cover the entire window of the point pattern. If it does not (which
may occur near the boundary because of discretisation error),
then the missing pixel values
will be obtained by applying a Gaussian blur to `lambda`

using
`blur`

, then looking up the values of this blurred image
for the missing locations.
(A warning will be issued in this case.)

If `lambda`

is a function, then it will be evaluated in the
form `lambda(x,y)`

where `x`

and `y`

are vectors
of coordinates of the points of `X`

. It should return a numeric
vector with length equal to the number of points in `X`

.

If `lambda`

is omitted, then it will be estimated using
a `leave-one-out' kernel smoother.
The estimate `lambda[i]`

for the
point `X[i]`

is computed by removing `X[i]`

from the
point pattern, applying kernel smoothing to the remaining points using
`density.ppp`

, and evaluating the smoothed intensity
at the point `X[i]`

. The smoothing kernel bandwidth is controlled
by the arguments `sigma`

and `varcov`

, which are passed to
`density.ppp`

along with any extra arguments.

##### Value

An object of class `"fv"`

, see `fv.object`

,
which can be plotted directly using `plot.fv`

.

##### References

Van Lieshout, M.N.M. and Baddeley, A.J. (1996)
A nonparametric measure of spatial interaction in point patterns.
*Statistica Neerlandica* **50**, 344--361.

Van Lieshout, M.N.M. (2010)
A J-function for inhomogeneous point processes.
*Statistica Neerlandica* **65**, 183--201.

##### See Also

##### Examples

```
# NOT RUN {
# }
# NOT RUN {
plot(Ginhom(swedishpines, sigma=bw.diggle, adjust=2))
# }
# NOT RUN {
plot(Ginhom(swedishpines, sigma=10))
# }
```

*Documentation reproduced from package spatstat, version 1.64-1, License: GPL (>= 2)*