Compute tolerance contours for the estimate of spatially-varying relative risk or spatially-varying probabilities of types.
tolcon(X, ..., nsim = 19, alternative=c("greater", "less", "two.sided"),
verbose = TRUE)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.
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.
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.
relrisk.ppp
ns <- if(interactive()) 19 else 9
Z <- tolcon(mucosa, sigma=0.1, nsim=ns)
plot(Z, main="")
Run the code above in your browser using DataLab