tolcon: Tolerance Contours for Relative Risk

View source: R/tolcon.R

tolconR Documentation

Tolerance Contours for Relative Risk

Description

Compute tolerance contours for the estimate of spatially-varying relative risk or spatially-varying probabilities of types.

Usage

tolcon(X, ..., nsim = 19, alternative=c("greater", "less", "two.sided"),
       verbose = TRUE)

Arguments

X

A multitype point pattern (object of class "ppp" with marks which are a factor).

...

Arguments passed to relrisk.ppp.

nsim

Number of simulations (random re-labellings of X) to be used to compute the tolerance contours.

alternative

Character string (partially matched) specifying the direction in which values are deemed significant.

verbose

Logical value indicating whether to print progress reports.

Details

This function computes tolerance contours for the images computed by relrisk.

The function relrisk computes estimates of spatially-varying relative risk in a case-control study, or spatially-varying type distribution in a multitype point pattern. Tolerance contours for relative risk (Hazelton and Davies, 2009) are curves drawn around the regions where the estimated relative risk (or estimated probability of a given type) is significantly different from the average risk or average proportion.

Significance is assessed by a Monte Carlo test. First the original dataset is analysed by calling relrisk(X, ...). Then X is randomly relabelled (that is, the marks attached to the points are randomly permuted using rlabel) and the estimate of relative risk or type probability is computed from this relabelled data. This is repeated nsim times, yielding nsim relative risk images or nsim lists of images of the probabilities of each time. A Monte Carlo p-value is computed at each pixel; these values are multiples of 1/(nsim+1), so the default nsim=19 produces p-values which are multiples of 1/20 = 0.05.

The result returned by tolcon is identical to the result returned by relrisk, except that each of the images of relative risk or type probability belongs to the additional class "tolcon". Each image of class "tolcon" has an attribute "pvalues" which is an image containing the relevant p-values. The class "tolcon" has a plot method which first plots the image and then draws the tolerance contour.

Value

An image or a list of images. Each image belongs to the additional class "tolcon" (for which there is a plot method) and has an attribute "pvalues" which is another image containing the p-values.

Author(s)

\adrian

, \tilman and \Lucia Cobo \Sanchez.

References

Hazelton, M.L. and Davies, T.M. (2009) Inference based on kernel estimates of the relative risk function in geographical epidemiology. Biometrical Journal 51, 98–109.

See Also

relrisk.ppp

Examples

   ns <- if(interactive()) 19 else 9
   Z <- tolcon(mucosa, sigma=0.1, nsim=ns)
   plot(Z, main="")

spatstat.explore documentation built on Nov. 22, 2025, 9:07 a.m.