# synthetic data: nonuniform Poisson process
X <- rpoispp(function(x,y) { 100 * exp(x) }, win=square(1))
# fit uniform Poisson process
fit0 <- ppm(X, ~1)
# test covariate = x coordinate
xcoord <- function(x,y) { x }
# test wrong model
k <- kstest(fit0, xcoord)
# plot result of test
plot(k, lwd0=3)
Run the code above in your browser using DataLab