Learn R Programming

spatstat.explore (version 3.8-3)

relriskAdaptiveKernel.ppp: Adaptive Estimate of Spatially-Varying Probability or Relative Risk

Description

Given a multitype point pattern, estimate the spatially-varying probability of each type of point, or the ratios of such probabilities, using kernel smoothing with adaptive bandwidths.

Usage

relriskAdaptiveKernel(X, ...)

# S3 method for ppp relriskAdaptiveKernel(X, bw = NULL, ..., adjust = 1, at = c("pixels", "points"), weights = NULL, relative = FALSE, normalise = FALSE, casecontrol = TRUE, control = 1, case)

Value

If X consists of only two types of points, and if casecontrol=TRUE, the result is a pixel image (if at="pixels") or a vector (if at="points"). The pixel values or vector values are the probabilities of a case if relative=FALSE, or the relative risk of a case (probability of a case divided by the probability of a control) if relative=TRUE.

If X consists of more than two types of points, or if casecontrol=FALSE, 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 "solist" 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\).

The pixel values or matrix entries are the probabilities of each type of point if relative=FALSE, or the relative risk of each type (probability of each type divided by the probability of a control) if relative=TRUE.

If relative=FALSE, the resulting values always lie between 0 and 1. If relative=TRUE, the results are either non-negative numbers, or the values Inf or NA.

If X has m > 1 columns of marks, the result is a list of length m containing the results for each column of marks as described above.

Arguments

X

A multitype point pattern (object of class "ppp" which has factor valued marks) or a point pattern with several columns of factor-valued marks.

bw

Numeric vector of smoothing bandwidths for each point in X, or a pixel image giving the smoothing bandwidth at each spatial location, or a spatial function of class "funxy" giving the smoothing bandwidth at each location. The default is to compute bandwidths using bw.abram.ppp.

adjust

Optional. Adjustment factor for the bandwidths bw.

...

Arguments passed to bw.abram.ppp to select the bandwidths, or passed to densityAdaptiveKernel.ppp to control the pixel resolution.

at

Character 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").

weights

Optional. Weights for the data points of X. A numeric or logical valued vector, pixel image, function or expression, or one of the strings "x" or "y" representing the cartesian coordinates. The expression may involve the variables x,y,marks representing the coordinates and marks of the point pattern.

relative

Logical. If FALSE (the default) the algorithm computes the probabilities of each type of point. If TRUE, it computes the relative risk, the ratio of probabilities of each type relative to the probability of a control.

normalise

Logical value specifying whether the results should be normalised so that constant risk corresponds to the value 1.

casecontrol

Logical. Whether to treat a bivariate point pattern as consisting of cases and controls, and return only the probability or relative risk of a case. Ignored if there are more than 2 types of points. See Details.

control

Integer, or character string, identifying which mark value corresponds to a control.

case

Integer, or character string, identifying which mark value corresponds to a case (rather than a control) in a bivariate point pattern. This is an alternative to the argument control in a bivariate point pattern. Ignored if there are more than 2 types of points.

Author

Adrian Baddeley [email protected], Rolf Turner [email protected] and Ege Rubak [email protected].

Details

The function relriskAdaptiveKernel is generic, with a method for point patterns of class "ppp" documented here.

This function performs the same task as relrisk.ppp except that relrisk.ppp performs fixed-bandwidth kernel smoothing using a single value of smoothing bandwidth sigma, whereas relriskAdaptiveKernel.ppp performs variable-bandwidth kernel smoothing using a different value of smoothing bandwidth for each point in the pattern X.

Calculation of standard errors is not yet supported.

See Also

relrisk.ppp, densityAdaptiveKernel.ppp, bw.abram.ppp.

Examples

Run this code
  bwa <- 2 * nndist(amacrine, proper=TRUE)
  A <- relriskAdaptiveKernel(amacrine, bw=bwa)

Run the code above in your browser using DataLab