X <- simdat
# Envelope of K function under CSR
## Not run:
# plot(envelope(X))
# ## End(Not run)
# Translation edge correction (this is also FASTER):
## Not run:
# plot(envelope(X, correction="translate"))
# ## End(Not run)
# Global envelopes
## Not run:
# plot(envelope(X, Lest, global=TRUE))
# plot(envelope(X, Kest, global=TRUE, scale=function(r) { r }))
# ## End(Not run)
# Envelope of K function for simulations from Gibbs model
## Not run:
# fit <- ppm(cells ~1, Strauss(0.05))
# plot(envelope(fit))
# plot(envelope(fit), global=TRUE)
# ## End(Not run)
# Envelope of K function for simulations from cluster model
fit <- kppm(redwood ~1, "Thomas")
## Not run:
# plot(envelope(fit, Gest))
# plot(envelope(fit, Gest, global=TRUE))
# ## End(Not run)
# Envelope of G function under CSR
## Not run:
# plot(envelope(X, Gest))
# ## End(Not run)
# Envelope of L function under CSR
# L(r) = sqrt(K(r)/pi)
## Not run:
# E <- envelope(X, Kest)
# plot(E, sqrt(./pi) ~ r)
# ## End(Not run)
# Simultaneous critical envelope for L function
# (alternatively, use Lest)
## Not run:
# plot(envelope(X, Kest, transform=expression(sqrt(./pi)), global=TRUE))
# ## End(Not run)
## One-sided envelope
## Not run:
# plot(envelope(X, Lest, alternative="less"))
# ## End(Not run)
# How to pass arguments needed to compute the summary functions:
# We want envelopes for Jcross(X, "A", "B")
# where "A" and "B" are types of points in the dataset 'demopat'
data(demopat)
## Not run:
# plot(envelope(demopat, Jcross, i="A", j="B"))
# ## End(Not run)
# Use of `simulate'
## Not run:
# plot(envelope(cells, Gest, simulate=expression(runifpoint(42))))
# plot(envelope(cells, Gest, simulate=expression(rMaternI(100,0.02))))
# ## End(Not run)
# Envelope under random toroidal shifts
data(amacrine)
## Not run:
# plot(envelope(amacrine, Kcross, i="on", j="off",
# simulate=expression(rshift(amacrine, radius=0.25))))
# ## End(Not run)
# Envelope under random shifts with erosion
## Not run:
# plot(envelope(amacrine, Kcross, i="on", j="off",
# simulate=expression(rshift(amacrine, radius=0.1, edge="erode"))))
# ## End(Not run)
# Envelope of INHOMOGENEOUS K-function with fitted trend
# The following is valid.
# Setting lambda=fit means that the fitted model is re-fitted to
# each simulated pattern to obtain the intensity estimates for Kinhom.
# (lambda=NULL would also be valid)
fit <- kppm(redwood ~1, clusters="MatClust")
## Not run:
# plot(envelope(fit, Kinhom, lambda=fit, nsim=19))
# ## End(Not run)
# Note that the principle of symmetry, essential to the validity of
# simulation envelopes, requires that both the observed and
# simulated patterns be subjected to the same method of intensity
# estimation. In the following example it would be incorrect to set the
# argument 'lambda=red.dens' in the envelope command, because this
# would mean that the inhomogeneous K functions of the simulated
# patterns would be computed using the intensity function estimated
# from the original redwood data, violating the symmetry. There is
# still a concern about the fact that the simulations are generated
# from a model that was fitted to the data; this is only a problem in
# small datasets.
## Not run:
# red.dens <- density(redwood, sigma=bw.diggle)
# plot(envelope(redwood, Kinhom, sigma=bw.diggle,
# simulate=expression(rpoispp(red.dens))))
# ## End(Not run)
# Precomputed list of point patterns
## Not run:
# nX <- npoints(X)
# PatList <- list()
# for(i in 1:19) PatList[[i]] <- runifpoint(nX)
# E <- envelope(X, Kest, nsim=19, simulate=PatList)
# ## End(Not run)
# re-using the same point patterns
## Not run:
# EK <- envelope(X, Kest, savepatterns=TRUE)
# EG <- envelope(X, Gest, simulate=EK)
# ## End(Not run)
Run the code above in your browser using DataLab