Learn R Programming

splancs (version 2.01-45)

Kenv.pcp: Calculate simulation envelope for a Poisson Cluster Process

Description

This function computes the envelope of Khat from simulations of a Poisson Cluster Process for a given polygon

Usage

Kenv.pcp(rho, m, s2, region.poly, larger.region=NULL, nsim, r, vectorise.loop=TRUE)

Value

ave

mean of simulations

upper

upper bound of envelope

lower

lower bound of envelope

Arguments

rho

intensity of the parent process

m

average number of offsprings per parent

s2

variance of location of offsprings relative to their parent

region.poly

a polygon defining the region in which the process is to be generated

larger.region

a rectangle containing the region of interest given in the form (xl,xu,yl,yu), defaults to sbox() around region.poly

nsim

number of simulations required

r

vector of distances at which the K function has to be estimated

vectorise.loop

if TRUE, use new vectorised code, if FALSE, use loop as before

Author

Giovanni Petris <GPetris@uark.edu>, Roger.Bivand@nhh.no

References

Diggle, P. J. (1983) Statistical analysis of spatial point patterns, London: Academic Press, pp. 55-57 and 78-81; Bailey, T. C. and Gatrell, A. C. (1995) Interactive spatial data analysis, Harlow: Longman, pp. 106-109.

See Also

pcp, pcp.sim, khat

Examples

Run this code
data(cardiff)
polymap(cardiff$poly)
pointmap(as.points(cardiff), add=TRUE)
title("Locations of homes of 168 juvenile offenders")
pcp.fit <- pcp(as.points(cardiff), cardiff$poly, h0=30, n.int=30)
pcp.fit
m <- npts(as.points(cardiff))/(areapl(cardiff$poly)*pcp.fit$par[2])
r <- seq(2,30,by=2)
K.env <- Kenv.pcp(pcp.fit$par[2], m, pcp.fit$par[1], cardiff$poly,
           nsim=20, r=r)
L.env <- lapply(K.env, FUN=function(x) sqrt(x/pi)-r)
limits <- range(unlist(L.env))
plot(r, sqrt(khat(as.points(cardiff),cardiff$poly,r)/pi)-r, ylim=limits,
     main="L function with simulation envelopes and average", type="l",
     xlab="distance", ylab="")
lines(r, L.env$lower, lty=5)
lines(r, L.env$upper, lty=5)
lines(r, L.env$ave, lty=6)
abline(h=0)

Run the code above in your browser using DataLab