# localKcross.inhom

##### Inhomogeneous Multitype K Function

Computes spatially-weighted versions of the the local multitype \(K\)-function or \(L\)-function.

- Keywords
- spatial, nonparametric

##### Usage

```
localKcross.inhom(X, from, to,
lambdaFrom=NULL, lambdaTo=NULL,
…, rmax = NULL,
correction = "Ripley", sigma=NULL, varcov=NULL,
lambdaX=NULL, update=TRUE, leaveoneout=TRUE)
localLcross.inhom(X, from, to,
lambdaFrom=NULL, lambdaTo=NULL, …, rmax = NULL)
```

##### Arguments

- X
A point pattern (object of class

`"ppp"`

).- from
Type of points from which distances should be measured. A single value; one of the possible levels of

`marks(X)`

, or an integer indicating which level.- to
Type of points to which distances should be measured. A single value; one of the possible levels of

`marks(X)`

, or an integer indicating which level.- lambdaFrom,lambdaTo
Optional. Values of the estimated intensity function for the points of type

`from`

and`to`

, respectively. Each argument should be either a vector giving the intensity values at the required points, 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.- …
Extra arguments. Ignored if

`lambda`

is present. Passed to`density.ppp`

if`lambda`

is omitted.- rmax
Optional. Maximum desired value of the argument \(r\).

- correction
String specifying the edge correction to be applied. Options are

`"none"`

,`"translate"`

,`"Ripley"`

,`"translation"`

,`"isotropic"`

or`"best"`

. Only one correction may be specified.- sigma, varcov
Optional arguments passed to

`density.ppp`

to control the kernel smoothing procedure for estimating`lambdaFrom`

and`lambdaTo`

, if they are missing.- lambdaX
Optional. Values of the estimated intensity function for all points of

`X`

. Either a vector giving the intensity values at each point of`X`

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

) giving the intensity values at all locations, a list of pixel images giving the intensity values at all locations for each type of point, or a fitted point process model (object of class`"ppm"`

) or a`function(x,y)`

or`function(x,y,m)`

which can be evaluated to give the intensity value at any location.- update
Logical value indicating what to do when

`lambdaFrom`

,`lambdaTo`

or`lambdaX`

is a fitted model (class`"ppm"`

,`"kppm"`

or`"dppm"`

). If`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 re-fitting it to`X`

.- leaveoneout
Logical value (passed to

`density.ppp`

or`fitted.ppm`

) specifying whether to use a leave-one-out rule when calculating the intensity.

##### Details

The functions `localKcross.inhom`

and `localLcross.inhom`

are inhomogeneous or weighted versions of the
local multitype \(K\) and \(L\) functions implemented in
`localKcross`

and `localLcross`

.

Given a multitype spatial point pattern `X`

,
and two designated types `from`

and `to`

,
the local multitype \(K\) function is
defined for each point `X[i]`

that belongs to type `from`

,
and is computed by
$$
K_i(r) = \sqrt{\frac 1 \pi \sum_j \frac{e_{ij}}{\lambda_j}}
$$
where the sum is over all points \(j \neq i\)
of type `to`

that lie
within a distance \(r\) of the \(i\)th point,
\(\lambda_j\) is the estimated intensity of the
point pattern at the point \(j\),
and \(e_{ij}\) is an edge correction
term (as described in `Kest`

).

The function
\(K_i(r)\) is computed for a range of \(r\) values
for each point \(i\). The results are stored as a function value
table (object of class `"fv"`

) with a column of the table
containing the function estimates for each point of the pattern
`X`

of type `from`

.

The corresponding \(L\) function \(L_i(r)\) is computed by applying the transformation \(L(r) = \sqrt{K(r)/(2\pi)}\).

##### Value

An object of class `"fv"`

, see `fv.object`

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

.
Essentially a data frame containing columns

the vector of values of the argument \(r\) at which the function \(K\) has been estimated

the theoretical value \(K(r) = \pi r^2\) or \(L(r)=r\) for a stationary Poisson process

##### See Also

##### Examples

```
# NOT RUN {
X <- amacrine
# compute all the local L functions
L <- localLcross.inhom(X)
# plot all the local L functions against r
plot(L, main="local L functions for ponderosa", legend=FALSE)
# plot only the local L function for point number 7
plot(L, iso007 ~ r)
# }
```

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