# linearKcross.inhom

##### Inhomogeneous multitype K Function (Cross-type) for Linear Point Pattern

For a multitype point pattern on a linear network, estimate the inhomogeneous multitype \(K\) function which counts the expected number of points of type \(j\) within a given distance of a point of type \(i\).

- Keywords
- spatial, nonparametric

##### Usage

```
linearKcross.inhom(X, i, j, lambdaI, lambdaJ,
r=NULL, …, correction="Ang", normalise=TRUE)
```

##### Arguments

- X
The observed point pattern, from which an estimate of the cross type \(K\) function \(K_{ij}(r)\) will be computed. An object of class

`"lpp"`

which must be a multitype point pattern (a marked point pattern whose marks are a factor).- i
Number or character string identifying the type (mark value) of the points in

`X`

from which distances are measured. Defaults to the first level of`marks(X)`

.- j
Number or character string identifying the type (mark value) of the points in

`X`

to which distances are measured. Defaults to the second level of`marks(X)`

.- lambdaI
Intensity values for the points of type

`i`

. Either a numeric vector, a`function`

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

or`"linim"`

) or a fitted point process model (object of class`"ppm"`

or`"lppm"`

).- lambdaJ
Intensity values for the points of type

`j`

. Either a numeric vector, a`function`

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

or`"linim"`

) or a fitted point process model (object of class`"ppm"`

or`"lppm"`

).- r
numeric vector. The values of the argument \(r\) at which the \(K\)-function \(K_{ij}(r)\) should be evaluated. There is a sensible default. First-time users are strongly advised not to specify this argument. See below for important conditions on \(r\).

- correction
Geometry correction. Either

`"none"`

or`"Ang"`

. See Details.- …
Arguments passed to

`lambdaI`

and`lambdaJ`

if they are functions.- normalise
Logical. If

`TRUE`

(the default), the denominator of the estimator is data-dependent (equal to the sum of the reciprocal intensities at the points of type`i`

), which reduces the sampling variability. If`FALSE`

, the denominator is the length of the network.

##### Details

This is a counterpart of the function `Kcross.inhom`

for a point pattern on a linear network (object of class `"lpp"`

).

The arguments `i`

and `j`

will be interpreted as
levels of the factor `marks(X)`

.
If `i`

and `j`

are missing, they default to the first
and second level of the marks factor, respectively.

The argument `r`

is the vector of values for the
distance \(r\) at which \(K_{ij}(r)\) should be evaluated.
The values of \(r\) must be increasing nonnegative numbers
and the maximum \(r\) value must not exceed the radius of the
largest disc contained in the window.

If `lambdaI`

or `lambdaJ`

is a fitted point process model,
the default behaviour is to update the model by re-fitting it to
the data, before computing the fitted intensity.
This can be disabled by setting `update=FALSE`

.

##### Value

An object of class `"fv"`

(see `fv.object`

).

##### Warnings

The arguments `i`

and `j`

are interpreted as
levels of the factor `marks(X)`

. Beware of the usual
trap with factors: numerical values are not
interpreted in the same way as character values.

##### References

Baddeley, A, Jammalamadaka, A. and Nair, G. (to appear)
Multitype point process analysis of spines on the
dendrite network of a neuron.
*Applied Statistics* (Journal of the Royal Statistical
Society, Series C), In press.

##### See Also

##### Examples

```
# NOT RUN {
lam <- table(marks(chicago))/(summary(chicago)$totlength)
lamI <- function(x,y,const=lam[["assault"]]){ rep(const, length(x)) }
lamJ <- function(x,y,const=lam[["robbery"]]){ rep(const, length(x)) }
K <- linearKcross.inhom(chicago, "assault", "robbery", lamI, lamJ)
# }
# NOT RUN {
fit <- lppm(chicago, ~marks + x)
linearKcross.inhom(chicago, "assault", "robbery", fit, fit)
# }
```

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