Learn R Programming

smacpod (version 1.0.0)

logrr.env: Envelopes for log ratio of spatial densities

Description

logrr.env computes envelopes for the log ratio of spatial density functions. The numerator in this ratio is related to the "cases" and the denominator to the "controls".

Usage

logrr.env(x, case = 2, nsim = 499, sigma = NULL, ..., weights = NULL,
  edge = TRUE, varcov = NULL, at = "pixels", leaveoneout = TRUE,
  adjust = 1, diggle = FALSE, nreport = 50)

Arguments

x
Point pattern (object of class "ppp").
case
The position of the name of the "case" group in levels(x$marks). The default is 2.
nsim
The number of simulated data sets from which to construct the envelopes under the random labeling hypothesis.
sigma
Standard deviation of isotropic Gaussian smoothing kernel. Either a numerical value, or a function that computes an appropriate value of sigma.
...
Additional arguments passed to pixellate.ppp and as.mask to determine the pixel resolution, or passed to sigma if it is a function.
weights
Optional weights to be attached to the points. A numeric vector, numeric matrix, or an expression.
edge
Logical flag: if TRUE, apply edge correction.
varcov
Variance-covariance matrix of anisotropic Gaussian kernel. Incompatible with sigma.
at
String specifying whether to compute the intensity values at a grid of pixel locations (at="pixels") or only at the points of x (at="points").
leaveoneout
Logical value indicating whether to compute a leave-one-out estimator. Applicable only when at="points".
adjust
Optional. Adjustment factor for the smoothing parameter.
diggle
Logical. If TRUE, use Diggle's edge correction, which is more accurate but slower to compute than the correction described under Details.
nreport
How frequently to report progress on the simulation. Default is 50.

Value

  • The function produces an object of type logrrenv. It's components are similar to those returned by the density.ppp function from the spatstat package, with the intensity values replaces by the log ratio of spatial densities of f and g. Includes an array simr of dimension c(nx, ny, nsim + 1), where nx and ny are the number of x and y grid points used to estimate the spatial density. simr[,,1] is the log ratio of spatial densities for the observed data and the remaining nsim elements in the third dimension of the array are the log ratios of spatial densities from a new ppp simulated under the random labeling hypothesis.

References

Waller, L.A. and Gotway, C.A. (2005). Applied Spatial Statistics for Public Health Data. Hoboken, NJ: Wiley. Kelsall, Julia E., and Peter J. Diggle. "Kernel estimation of relative risk." Bernoulli (1995): 3-16. Kelsall, Julia E., and Peter J. Diggle. "Non-parametric estimation of spatial variation in relative risk." Statistics in Medicine 14.21-22 (1995): 2335-2342.

Examples

Run this code
data(grave)
renv = logrr.env(grave, nsim = 9)

Run the code above in your browser using DataLab