Appendix 6: Preliminary definitions and concepts in point pattern analysis
Appendix 6.1: Point pattern datasets
Many R packages are available for analyzing point pattern data. The most up-to- date and comprehensive is certainly (spatstat) (Baddeley et al., 2015). The functions contained in this library to analyze a point pattern require it to be in the form of an object of class ppp, which states for planar point pattern. A ppp object is made up of at least the spatial coordinates of the points and the data identifying the study area of the pattern. Such an object can be created using the function ppp, whose essential inputs that the user has to provide are the xand у vectors of spatial coordinates of the points and the argument that specifies the study area. If the study area is a square or a rectangle, it can be specified using the arguments arrange and grange that indicate the ranges of the horizontal and vertical sides of the study area, respectively. If the study area has a more complex polygonal shape, the proper argument is poly, which has to be provided as a list with elements x and у representing the spatial coordinates of the polygon’s vertices.
As an example, let us see how to create a ppp object representing a point pattern with 30 observations in a rectangular study area from spatial coordinates data. First of all, let us generate the hypothetical arbitrary a; and у coordinates of the points with ranges [0, 20] and [0,10] respectively:
> xcoord <- runif(30, min=0, max=20)
> ycoord <- runif(30, min=0, max=l0)
Then, let us create the desired object and visualize it using the plot method for ppp class:
> ptsdata <- ppp(x=xcoord, y=ycoord, xrange=c(0,20),
As a second example, let us consider the case of a polygonal study area, specified using the argument poly:
> ptsdata2 <- ppp(x=xcoord, y=ycoord,
+ poly=list(X=C(20,20,15,8,0,0) , y=c(0,10,12,10,15,0)))
The ppp function allows us also to deal with other types of data for the study area, such as pixel images. Typerppp to get further details.