I seem to have found a discrepancy in the results of a univariate Ripley's K point pattern analysis (figure 1). To begin, I generated a 1x1 uniform point grid to see if my R script was producing logical results (Figure 2). The study area is 20x40 (Figure2). Given the completely uniform data, I would not expect to see any random or clustered point patterns at any search distance (r). The attached script was used to generate these results. Under these controlled conditions why am I seeing clustering and CSR when there should only be a uniform point pattern?
require(spatstat)
require(maptools)
require(splancs)
# Local Variables
flower = 0
year = 2013
# Read the shapefile
sdata = readShapePoints("C:/temp/sample_final.shp") #Read the shapefile
data = sdata[sdata$flow_new == flower,] # subset only flowering plants
data2 = data[data$year == year,] # subset flowering plants at year X
data.frame(data2) # Check the data
# Get the ripras estimate of area based on the study area measurements
gapdata = readShapePoints("C:/temp/study_area_boundary.shp") #Read the shapefile
whole = coordinates(gapdata) # get just the coords, excluding other data
win = convexhull.xy(whole) # Ripras will determine a good bounding polygon for the points (usually a variant of Convex Hull)
plot(win)
# Converting to PPP
points = coordinates(data2) # get just the coords, excluding other data
ppp = as.ppp(points, win) # Convert the points into the spatstat format
data.check = data.frame(ppp) # Check the format of the ppp data
summary(ppp) # General info about the created ppp object
plot(ppp) # Visually check the points and bounding area
# Now run the ppa
L.Env.ppp = envelope(ppp, Lest, nsim = 1000, correction = "best", rank =1)
plot(L.Env.ppp, main = "Uniform Test")
abline(v=(seq(1:12)), lty="dotted")
Figure 1
Results of the analysis
Figure 2
The uniform points and the window
Those points are regularly dispersed (sometimes also called hyperdispersed). Although in a colloquial sense they appear uniform, the point process underlying them is not itself uniform: if it were, there would be some chance of point pairs less than one unit apart.
In drawing your attention to that short range deviation from uniformity, Ripley's K is performing exactly as it was designed to!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With