Description Usage Arguments Details Value Examples
This is a point pattern test that measures the degree of similarity at the local level between two spatial point patterns and is an area-based test.
1 2 3 4 5 6 7 8 9 10 |
base_points.sp |
the Base data of type SpatialPoints* |
test_points.sp |
the Test data of type SpatialPoints* |
uoa.sp |
the units of analysis of type SpatialPolygons* |
outputlist |
should the output of the function be a list, including all simulation runs as a matrix? default = FALSE |
nsamples |
number of samples in simulations, default = 200 |
percpoints |
percentage of points used in simulations, default = 85 |
conf_level |
confidence interval, default = 95 |
bootstrap |
logical, default is FALSE |
In its default settings, the function is the original Andresen's sppt, so only Test data is randomly resampled (without replacement, by default using 85
By changing 'bootstrap' to TRUE, the 'percpoints' argument is ignored and the Test points are a bootstrapped sample: within each simualed dataset, as many points as the test set itself are sampled, but with replacement within each sample.
When outputlist
is FALSE
(the default), returns the
uoa.sp
spatialobject including SPPT outcomes. When
outputlist
is TRUE
(the default), returns a list with
the first list element the uoa.sp
spatialobject including
SPPT outcomes, and the second list element a matrix of all
nsamples
simulations.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # Plot areas, base points data, and test points data
plot(areas.sp)
text(coordinates(areas.sp), label = areas.sp$ID)
text(coordinates(points1.sp), label = points1.sp$ID, col="blue")
text(coordinates(points2.sp), label = points2.sp$ID, col="red")
set.seed(76772)
myoutput <- sppt(base_points.sp = points1.sp, test_points.sp = points2.sp, uoa.sp = areas.sp)
summary_sppt(myoutput)
myoutput@data
# is exactly the same as:
set.seed(76772)
myoutput <- sppt(points1.sp, points2.sp, areas.sp,
outputlist=FALSE, nsamples=200, percpoints=85, conf_level=95)
myoutput@data
# now with a list being outputted, the 2nd element has all simulation outcomes
set.seed(76772)
myoutput <- sppt(points1.sp, points2.sp, areas.sp, outputlist = TRUE)
head(myoutput[[1]]@data) # same as previous
head(myoutput[[2]])
# Vancouver data
set.seed(9866)
myoutput <- sppt(vancouver_points1.sp, vancouver_points2.sp, vancouver_areas.sp)
summary_sppt(myoutput)
# Vancouver data, using a bootstrap approach instead of Andresen's subsampling method
set.seed(9866)
myoutput <- sppt(vancouver_points1.sp, vancouver_points2.sp, vancouver_areas.sp, bootstrap = TRUE)
summary_sppt(myoutput)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.