Learn R Programming

smacpod (version 1.0.0)

tolenv: Tolerance envelopes for log ratio of spatial densities.

Description

tolenv determines tolerance envelopes for the log ratio of spatial densities of cases and controls. Specifically, the function identifies where the observed log ratio of spatial densities exceeds what is expected under the random labeling hypothesis. Results can be easily plotted using the contour or image functions.

Usage

tolenv(object, level, direction)

## S3 method for class 'renv': tolenv(object, level = 0.95, direction = "both")

Arguments

object
An renv object from the logrr.env function.
level
Confidence level. Should be a number between 0 and 1. Default is 0.95.
direction
Default is "both". Can also be "upper" or "lower".

Value

  • Returns an tolenvr object. This is just a list with components x, y, and z the can be used with the image or contour functions quite easily.

Details

direction="both" identifies locations where the observed log ratio of spatial densities is below and above, respectively, the (1-level)/2 and 1 - (1-level)/2 quantiles of log ratios of spatial densities simulated under the random labeling hypothesis. "upper" finds where the observed ratio exceeds the "level" quantile. "lower" finds where the observed ratio exceeds the 1 - level quantile.

The z argument of the list returned has a -1 for locations where the observed log ratio of spatial densities is below the tolerance envelope, a 0 for locations within the tolerance envelope, and a 1 for locations where the log ratio of spatial densities exceeds the tolerance envelope.

References

Waller, L.A. and Gotway, C.A. (2005). Applied Spatial Statistics for Public Health Data. Hoboken, NJ: Wiley.

Examples

Run this code
data(grave)
renv = logrr.env(grave, nsim = 9)
tol = tolenv(renv, level = 0.8)
image(tol, col = c("blue", "white", "orange"), asp = 1)
contour(renv, add = TRUE)
polygon(grave$window$bdry[[1]])

Run the code above in your browser using DataLab