kdest {smacpod} | R Documentation |
Difference of estimated K functions
Description
kdest
computes the difference in estimated K functions for a set of
cases and controls, with KD(r) = K_case(r) - K_control(r)
denoting the
estimated difference at distance r
. If nsim > 0
, then pointwise
tolerance envelopes for KD(r)
are constructed under the random
labeling hypothesis for each distance r
. The summary
function
can be used to determine the distances for which KD(r)
is above or
below the tolerance envelopes. The plot
function will plot
KD(r)
versus r, along with the tolerance envelopes, the min/max
envelopes of KD(r)
simulated under the random labeling hypothesis, and
the average KD(r) under the random labeling hypothesis.
Usage
kdest(
x,
case = 2,
nsim = 0,
level = 0.95,
r = NULL,
rmax = NULL,
breaks = NULL,
correction = c("border", "isotropic", "Ripley", "translate"),
nlarge = 3000,
domain = NULL,
var.approx = FALSE,
ratio = FALSE
)
Arguments
x |
A |
case |
The name of the desired "case" group in
|
nsim |
The number of simulated data sets from which to construct tolerance envelopes under the random labeling hypothesis. The default is 0 (i.e., no envelopes). |
level |
The level of the tolerance envelopes. |
r |
Optional. Vector of values for the argument |
rmax |
Optional. Maximum desired value of the argument |
breaks |
This argument is for internal use only. |
correction |
Optional. A character vector containing any selection of the
options |
nlarge |
Optional. Efficiency threshold.
If the number of points exceeds |
domain |
Optional. Calculations will be restricted to this subset of the window. See Details. |
var.approx |
Logical. If |
ratio |
Logical.
If |
Details
This function relies internally on the Kest
and
eval.fv
functions. The arguments are essentially the same as the
Kest
function, and the user is referred there
for more details about the various arguments.
Value
Returns a kdenv
object. See documentation
for Kest
.
Author(s)
Joshua French
References
Waller, L.A. and Gotway, C.A. (2005). Applied Spatial Statistics for Public Health Data. Hoboken, NJ: Wiley.
See Also
Examples
data(grave)
# estimate and plot KD(r)
kd1 = kdest(grave, case = "affected")
plot(kd1, iso ~ r, ylab = "difference", legend = FALSE, main = "")
kd2 = kdest(grave, case = 2, nsim = 9, level = 0.8)
kd2 # print object
summary(kd2) # summarize distances KD(r) outside envelopes
plot(kd2)
# manually add legend
legend("bottomright", legend = c("obs", "avg", "max/min env", "95% env"),
lty = c(1, 2, 1, 2), col = c("black", "red", "darkgrey", "lightgrey"),
lwd = c(1, 1, 10, 10))