khat
K-function
Calculates an estimate of the K-function
- Keywords
- spatial
Usage
khat(pts,poly,s,newstyle=FALSE)
print.khat(x, ...)
plot.khat(x, ...)
Arguments
- pts
- A points data set
- poly
- A polygon containing the points
- s
- A vector of distances at which to calculate the K function
- newstyle
- if TRUE, the function returns a khat object
- x
- a
khat
object - ...
- other arguments passed to plot and print functions
Details
The K function is defined as the expected number of further points within a distance s of an arbitrary point, divided by the overall density of the points. In practice an edge-correction is required to avoid biasing the estimation due to non-recording of points outside the polygon.
The newstyle argument and khat object were introduced in collaboration
with Thomas de Cornulier
Value
- If
newstyle
is FALSE, a vector likes
containing the value of K at the points ins
. else akhat
object list with: khat the value of K at the points in s
counts integer matrix of counts of points within the vector of distances s
for each pointkhats matrix of values of K within the vector of distances s
for each points s
References
Ripley, B.D. 1976 The second-order analysis of stationary point processes,
J. Appl. Prob, 13 255-266;
Rowlingson, B. and Diggle, P. 1993 Splancs: spatial point pattern analysis
code in S-Plus. Computers and Geosciences, 19, 627-655;
the original sources can be accessed at:
See Also
Examples
data(cardiff)
s <- seq(2,30,2)
plot(s, sqrt(khat(as.points(cardiff), cardiff$poly, s)/pi) - s,
type="l", xlab="Splancs - polygon boundary", ylab="Estimated L",
ylim=c(-1,1.5))
newstyle <- khat(as.points(cardiff), cardiff$poly, s, newstyle=TRUE)
str(newstyle)
newstyle
apply(newstyle$khats, 2, sum)
plot(newstyle)