# relrisk

##### Nonparametric Estimate of Spatially-Varying Relative Risk

Given a multitype point pattern, this function estimates the spatially-varying probability of each type of point, using cross-validated kernel smoothing.

##### Usage

`relrisk(X, sigma = NULL, ..., varcov = NULL, at = "pixels")`

##### Arguments

- X
- A multitype point pattern (object of class
`"ppp"`

which has factor valued marks). - sigma
- Optional. Standard deviation of isotropic Gaussian smoothing kernel.
- ...
- Arguments passed to
`bw.relrisk`

to select the bandwidth, or passed to`density.ppp`

to control the pixel resolution. - varcov
- Optional. Variance-covariance matrix of anisotopic Gaussian
smoothing kernel. Incompatible with
`sigma`

. - at
- String specifying whether to compute the probability values
at a grid of pixel locations (
`at="pixels"`

) or only at the points of`X`

(`at="points"`

).

##### Details

If `X`

is a multitype point pattern with $m > 2$ types,
then this command computes, for each type $j$,
a nonparametric estimate of
the spatially-varying risk of an event of type $j$.
This is the probability $p_j(u)$
that a point at spatial location $u$
will belong to type $j$.
If `X`

consists of only two types of points,
then points of the first type (the first level of `marks(X)`

)
are treated as controls or non-events, and points of the second type
are treated as cases or events. Then this command computes
the spatially-varying risk of an event,
i.e. the probability $p(u)$
that a point at spatial location $u$
will be a case.

If `at = "pixels"`

the calculation is performed for
every spatial location $u$ on a fine pixel grid, and the result
is a pixel image representing the function $p(u)$
or a list of pixel images representing the functions
$p_j(u)$ for $j = 1,\ldots,m$.

If `at = "points"`

the calculation is performed
only at the data points $x_i$. The result is a vector of values
$p(x_i)$ giving the estimated probability of a case
at each data point, or a matrix of values
$p_j(x_i)$ giving the estimated probability of
each possible type $j$ at each data point.

Estimation is performed by a simple Nadaraja-Watson type kernel
smoother (Diggle, 2003). If `sigma`

and `varcov`

are both missing or null, then the smoothing bandwidth `sigma`

is selected by cross-validation using `bw.relrisk`

.

##### Value

- If
`X`

consists of only two types of points, the result is a pixel image (if`at="pixels"`

) or a vector of probabilities (if`at="points"`

).If

`X`

consists of more than two types of points, the result is:- (if
`at="pixels"`

) a list of pixel images, with one image for each possible type of point. The result also belongs to the class`"listof"`

so that it can be printed and plotted. - (if
`at="points"`

) a matrix of probabilities, with rows corresponding to data points$x_i$, and columns corresponding to types$j$.

- (if

##### References

Diggle, P.J. (2003)
*Statistical analysis of spatial point patterns*,
Second edition. Arnold.

##### See Also

##### Examples

```
data(urkiola)
p <- relrisk(urkiola, 20)
plot(p, main="proportion of oak")
```

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