kstest2d: Nonparametric Goodness-of-fit test between two point patterns

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/kstest2d.R

Description

This function performs a two-dimensional Kolmogorov-Smirnov goodness-of-fit test on two point patterns.

For examples see

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

Usage

1
kstest2d(x1, x2, showinfo = TRUE)

Arguments

x1, x2

Objects of class ppp.

showinfo

Logical variable. Requests to display the test conclusion based on the value of the p-value. Default is TRUE.

Value

A list with class "htest" containing the following components:

statistic

Value of the KS statistic

p.value

The p-value of the test

alternative

A character string describing the alternative hypothesis

Author(s)

Jiaxun Chen, Sakis Micheas

References

Peacock, J.A. (1983). Two-dimensional goodness-of-fit testing in astronomy. Monthly Notices Royal Astronomy Society, 202, 615-627.

Adapted from Matlab code by Dylan Muir.

See Also

rnormmix,to_int_surf,owin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# generate two point patterns
mix1 <- rnormmix(3, sig0 = .01, df = 5, xlim=c(0, 5), ylim=c(0, 5))
intsurf1=to_int_surf(mix1,lambda = 40, win =spatstat::owin( c(0, 5),c(0, 5)))
mix2 <- rnormmix(8, sig0 = .01, df = 10, xlim=c(0, 5),ylim=c(0, 5))
intsurf2=to_int_surf(mix2,lambda = 50, win =spatstat::owin( c(0, 5),c(0, 5)))
#generate patterns from the two different models
pp1 <- rsppmix(intsurf1)
pp2 <- rsppmix(intsurf2)
pp3 <- rsppmix(intsurf2)#pp3 is from the same model as pp2
# Test for goodness of fit, p-value should be small
kstest2d(pp1, pp2)
# Test for goodness of fit, p-value should be large
kstest2d(pp2, pp3)

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