kstest2dsurf: Nonparametric Goodness-of-fit test for a point pattern...

Description Usage Arguments Author(s) See Also Examples

View source: R/kstest2d.R

Description

This function performs a two-dimensional Kolmogorov-Smirnov goodness-of-fit test for a point pattern against a given intensity surface.

For examples see

http://faculty.missouri.edu/~micheasa/sppmix/sppmix_all_examples.html#kstest2dsurf

Usage

1
kstest2dsurf(pp, intsurf, truncate = FALSE, iters = 500)

Arguments

pp

Object of class ppp.

intsurf

Object of class intensity_surface.

truncate

Requests to truncate the generated point patterns to be within the window of the intensity object intsurf. Default is FALSE.

iters

Number of point patterns to generate and compare against pp. The larger this value is, the more test performed, and thus the more reliable the result.

Author(s)

Sakis Micheas

See Also

rmixsurf, kstest2d, rsppmix, plotmix_2d

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# generate two intensity surfaces; assume the same window [-3,3]x[-3,3]
mixsurf1 <- rmixsurf(m = 3, lambda=100,xlim=c(-3,3),ylim=c(-3,3))
plot(mixsurf1)
mixsurf2 <- rmixsurf(m = 5, lambda=200,xlim=c(-3,3),ylim=c(-3,3))
plot(mixsurf2)
#generate point patterns from the two different models
pp1 <- rsppmix(mixsurf1, truncate=FALSE)
plotmix_2d(mixsurf1,pp1,colors=TRUE)
pp2 <- rsppmix(mixsurf2, truncate=FALSE)
plotmix_2d(mixsurf2,pp2,colors=TRUE)
# Test for goodness of fit, p-value should be small
kstest2d(pp1, pp2)
# Test each pattern for gof against both Poisson models
kstest2dsurf(pp1, mixsurf1)#correct model for pp1
kstest2dsurf(pp1, mixsurf2)#wrong model for pp1
kstest2dsurf(pp2, mixsurf2)#correct model for pp2
kstest2dsurf(pp2, mixsurf1)#wrong model for pp2

sppmix documentation built on Jan. 13, 2021, 10:04 p.m.