scan.test | R Documentation |
scan.test
performs the original spatial scan test
of Kulldorf (1997) based on a fixed number of cases.
Candidate zones are circular and extend from the observed
region centroids. The clusters returned are
non-overlapping, ordered from most significant to least
significant. The first cluster is the most likely to be
a cluster. If no significant clusters are found, then
the most likely cluster is returned (along with a
warning).
scan.test(
coords,
cases,
pop,
ex = sum(cases)/sum(pop) * pop,
nsim = 499,
alpha = 0.1,
ubpop = 0.5,
longlat = FALSE,
cl = NULL,
type = "poisson",
min.cases = 2,
simdist = "multinomial"
)
coords |
An |
cases |
The number of cases observed in each region. |
pop |
The population size associated with each region. |
ex |
The expected number of cases for each region. The default is calculated under the constant risk hypothesis. |
nsim |
The number of simulations from which to compute the p-value. |
alpha |
The significance level to determine whether a cluster is signficant. Default is 0.10. |
ubpop |
The upperbound of the proportion of the total population to consider for a cluster. |
longlat |
The default is |
cl |
A cluster object created by |
type |
The type of scan statistic to compute. The
default is |
min.cases |
The minimum number of cases required for a cluster. The default is 2. |
simdist |
Character string indicating the simulation
distribution. The default is |
Returns a smerc_cluster
object.
Joshua French
Kulldorff, M. (1997) A spatial scan statistic. Communications in Statistics - Theory and Methods, 26(6): 1481-1496, <doi:10.1080/03610929708831995>
Waller, L.A. and Gotway, C.A. (2005). Applied Spatial Statistics for Public Health Data. Hoboken, NJ: Wiley.
print.smerc_cluster
,
summary.smerc_cluster
,
plot.smerc_cluster
,
scan.stat
data(nydf)
coords <- with(nydf, cbind(longitude, latitude))
out <- scan.test(
coords = coords, cases = floor(nydf$cases),
pop = nydf$pop, nsim = 0,
alpha = 1, longlat = TRUE
)
# basic plot
plot(out, idx = 1:3)
# better plot
if (require("sf", quietly = TRUE)) {
data(nysf)
plot(st_geometry(nysf),
col = color.clusters(out, idx = 1:3))
}
## plot output for new york state
# specify desired argument values
mapargs <- list(
database = "county", region = "new york",
xlim = range(out$coords[, 1]),
ylim = range(out$coords[, 2])
)
# only run this example if maps available
if (require("maps", quietly = TRUE)) {
# needed for "state" database (unless you execute library(maps))
data(countyMapEnv, package = "maps")
plot(out, usemap = TRUE, mapargs = mapargs, idx = 1:3)
}
# extract detected clusteers
clusters(out)
# a second example to match the results of Waller and Gotway (2005)
# in chapter 7 of their book (pp. 220-221).
# Note that the 'longitude' and 'latitude' used by them has
# been switched. When giving their input to SatScan, the coords
# were given in the order 'longitude' and 'latitude'.
# However, the SatScan program takes coordinates in the order
# 'latitude' and 'longitude', so the results are slightly different
# from the example above.
# Note: the correct code below would use cbind(x, y), i.e.,
# cbind(longitude, latitude)
coords <- with(nydf, cbind(y, x))
out2 <- scan.test(
coords = coords, cases = floor(nydf$cases),
pop = nydf$pop, nsim = 0,
alpha = 1, longlat = TRUE
)
# the cases observed for the clusters in Waller and Gotway: 117, 47, 44
# the second set of results match
clusters(out2, idx = 1:3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.