Description Usage Arguments Value Examples
As opposed to the traditional SPPT, this test calculates the difference in the proportions using either a variety of Chi-square proportions tests or using Fisher's exact test, and then the p-values are adjusted for multiple comparisons. See https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3111822 for a description and example.
1 2 3 4 5 6 7 8 | sppt_diff(
p1.sp,
p2.sp,
uoa.sp,
conf_level = 95,
test = "Chi2_Nmin1",
adj = "BY"
)
|
p1.sp |
the first points of type SpatialPoints*, order does not matter |
p2.sp |
the second points of type SpatialPoints*, order does not matter |
uoa.sp |
the units of analysis of type SpatialPolygons* |
conf_level |
confidence interval, default = 95 |
test |
test to conduct, choice of "Chi2_Nmin1", "Chi2", "Yates", or "Fisher", default = "Chi2_Nmin1" |
adj |
method to adjust p-values (as per stats::p.adjust), default "BY". To turn off, set to "none". |
Returns uoa.sp (a spatial polygons data frame) including sppt_diff outcomes.
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")
output <- sppt_diff(points1.sp, points2.sp, areas.sp, test="Chi2_Nmin1")
summary_sppt(output)
output@data
output <- sppt_diff(points1.sp, points2.sp, areas.sp, test="Fisher")
summary_sppt(output)
output@data
# sppt_diff(points1.sp, points2.sp, areas.sp, test="????") # should get error message
# Vancouver data
set.seed(9866)
myoutput <- sppt_diff(vancouver_points1.sp, vancouver_points2.sp, vancouver_areas.sp)
summary_sppt(myoutput)
# The sppt_diff() outcomes without correction for multiple comparisons
# are close to sppt_boot() outcomes:
set.seed(9866)
myoutput1 <- sppt_diff(vancouver_points1.sp, vancouver_points2.sp,
vancouver_areas.sp, test = "Chi2_Nmin1", adj = "none")
summary_sppt(myoutput1)
set.seed(9866)
myoutput2 <- sppt_boot(vancouver_points1.sp, vancouver_points2.sp,
vancouver_areas.sp)
summary_sppt(myoutput2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.