The spatgeom package provides goodness-of-fit tests for spatial point process models.
The spatgeom package provides the implementation to perform the geometric spatial point analysis developed in Hernández & Solís (2022) doi:10.1007/s00180-022-01244-1. It estimates the geometric goodness-of-fit index for a set of variables against a response one based on the 'sf' package. The package has methods to print and plot the results.
The package is currently available on CRAN and can be installed using:
install.packages("spatgeom")
and loaded using the following command:
library(spatgeom)
The package has one main function spatgeom that takes as input a set of variables and a response one.
For example, this is how you can use the package to estimate the geometric goodness-of-fit index with a set of variables in a donut shape against a response one:
xy <- donut_data(n = 100, a = -1, b = 1, theta = 2 * pi)
estimation <- spatgeom(y = xy[, 1], x = xy[, -1])
The package allow to estimate the envelope of the curve using the parameter envelope=TRUE:
estimation <- spatgeom(y = xy[, 1], x = xy[, -1], envelope = TRUE)
In the example, the estimation object is a list of class spatgeom with the following elements:
ncol(x) corresponding to each column of x. Each element of the list has:
sf::st_sf()])with columns geometry, segments, max_length and alpha. The data.frame contains the whole Delanauy triangulation for the corresponding column of x and y. The segments column are the segments of each individual triangle and max_length is the maximum length of them.The package has a print method for objects of class spatgeom:
print(estimation)
and a plot method for objects of class spatgeom. The plot method has two options: curve and deriv. The curve option plots the curve of of the goodness-of-fit index. The deriv option plots the numerical derivative.
plot_curve(estimation, type = "curve")
plot_curve(estimation, type = "deriv")
If you use the spatgeom package in your work, please cite the following paper:
Hernández, D. and Solís, F. (2022). Geometric goodness-of-fit tests for spatial point process models. Statistics and Computing, 32(1), 1-19. doi:10.1007/s00180-022-01244-1
Solís, M., Hernández, A., & Pasquier, C. (2023). spatgeom: Geometric Spatial Point Analysis (0.3.0). https://cran.r-project.org/web/packages/spatgeom/index.html
This package is free and open source software, licensed under MIT License. See the LICENSE file for details.