echepoi {echelon} | R Documentation |
Echelon spatial scan statistic based on Poisson model
Description
echepoi
detects spatial clusters using echelon spatial scan statistic based on Poisson model.
Usage
echepoi(echelon.obj, cas, pop = NULL, ex = NULL, K = length(cas)/2, n.sim = 99,
cluster.type = "high", cluster.legend.pos = "bottomleft",
dendrogram = TRUE, cluster.info = FALSE, coo = NULL, ...)
Arguments
echelon.obj |
An object of class |
cas |
A numeric (integer) vector of case counts.
|
pop |
A numeric (integer) vector for population.
|
ex |
A numeric vector for expected cases.
|
K |
Maximum cluster size. if |
n.sim |
Number of Monte Carlo replications used for significance testing of detected clusters. If 0, the significance is not assessed. |
cluster.type |
A character string specifying the cluster type. If |
cluster.legend.pos |
A location of the legend on the dendrogram. (See the help for |
dendrogram |
Logical. if TRUE, draw an echelon dendrogram with detected clusters. |
cluster.info |
Logical. if TRUE, return the result of detected clusters for detail. |
coo |
An array of (x,y)-coordinates of the region centroid to draw a cluster map. |
... |
Related to dendrogram drawing. (See the help for |
Value
clusters |
Each detected cluster. |
scanned.regions |
A region list of all scanning processes. |
simulated.LLR |
Monte Carlo samples of the log-likelihood ratio. |
Note
echepoi
requires either pop
or ex
.
Typical values of n.sim
are 99, 999, 9999, ...
Author(s)
Fumio Ishioka
References
[1] Kulldorff M. (1997). A spatial scan statistic. Communications in Statistics: Theory and Methods, 26, 1481–1496.
[2] Ishioka F, Kawahara J, Mizuta M, Minato S, and Kurihara K. (2019) Evaluation of hotspot cluster detection using spatial scan statistic based on exact counting. Japanese Journal of Statistics and Data Science, 2, 241–262.
See Also
echelon
for the echelon analysis.
echebin
for cluster detection based on echelons using Binomial model.
Examples
##Hotspot detection for SIDS data of North Carolina using echelon scan
#Mortality rate per 1,000 live births from 1974 to 1984
library(spData)
data("nc.sids")
SIDS.cas <- nc.sids$SID74 + nc.sids$SID79
SIDS.pop <- nc.sids$BIR74 + nc.sids$BIR79
SIDS.rate <- SIDS.cas * 1000 / SIDS.pop
#Hotspot detection based on Poisson model
SIDS.echelon <- echelon(x = SIDS.rate, nb = ncCR85.nb, name = row.names(nc.sids))
echepoi(SIDS.echelon, cas = SIDS.cas, pop = SIDS.pop, K = 20,
main = "Hgih rate clusters", ens = FALSE)
text(SIDS.echelon$coord, labels = SIDS.echelon$regions.name,
adj = -0.1, cex = 0.7)
#Detected clusters and neighbors map
#XY coordinates of each polygon centroid point
NC.coo <- cbind(nc.sids$lon, nc.sids$lat)
echepoi(SIDS.echelon, cas = SIDS.cas, pop = SIDS.pop, K = 20,
coo = NC.coo, dendrogram = FALSE)
##Detected clusters map
#Here is an example using the sf class "sf"
SIDS.clusters <- echepoi(SIDS.echelon, cas = SIDS.cas,
pop = SIDS.pop, K = 20, dendrogram = FALSE)
MLC <- SIDS.clusters$clusters[[1]]
Secondary <- SIDS.clusters$clusters[[2]]
cluster.col <- rep(0,times=length(SIDS.rate))
cluster.col[MLC$regionsID] <- 2
cluster.col[Secondary$regionsID] <- 3
library(sf)
nc <- st_read(system.file("shape/nc.shp", package = "sf"))
plot(nc$geometry, col = cluster.col,
main = "Detected high rate clusters")
text(st_coordinates(st_centroid(st_geometry(nc))),
labels = nc$CRESS_ID, cex =0.75)
legend("bottomleft",
c(paste("1- p-value:", MLC$p),
paste("2- p-value:", Secondary$p)),
text.col = c(2,3))