
flex_test
performs the flexibly-shaped scan test
of Tango and Takahashi (2005).
flex_test(
coords,
cases,
pop,
w,
k = 10,
ex = sum(cases)/sum(pop) * pop,
type = "poisson",
nsim = 499,
alpha = 0.1,
longlat = FALSE,
cl = NULL,
lonlat = longlat,
...
)
An
The number of cases observed in each region.
The population size associated with each region.
A binary spatial adjacency matrix for the regions.
An integer indicating the maximum number of regions to inclue in a potential cluster. Default is 10
The expected number of cases for each region. The default is calculated under the constant risk hypothesis.
The type of scan statistic to compute. The
default is "poisson"
. The other choice
is "binomial"
.
The number of simulations from which to compute the p-value.
The significance level to determine whether a cluster is signficant. Default is 0.10.
The default is FALSE
, which
specifies that Euclidean distance should be used. If
longlat
is TRUE
, then the great circle
distance is used to calculate the intercentroid
distance.
A cluster object created by makeCluster
,
or an integer to indicate number of child-processes
(integer values are ignored on Windows) for parallel evaluations
(see Details on performance).
Deprecated in favor of longlat
.
Not used.
Returns a list of length two of class scan. The first element (clusters) is a list containing the significant, non-ovlappering clusters, and has the the following components:
The test is performed using the spatial scan test based on the Poisson test statistic and a fixed number of cases. 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).
Tango, T., & Takahashi, K. (2005). A flexibly shaped spatial scan statistic for detecting clusters. International journal of health geographics, 4(1), 11. Kulldorff, M. (1997) A spatial scan statistic. Communications in Statistics -- Theory and Methods 26, 1481-1496.
print.smerc_cluster
,
summary.smerc_cluster
,
plot.smerc_cluster
,
scan.stat
, scan.test
# NOT RUN {
data(nydf)
data(nyw)
coords = with(nydf, cbind(longitude, latitude))
out = flex_test(coords = coords, cases = floor(nydf$cases),
w = nyw, k = 3,
pop = nydf$pop, nsim = 49,
alpha = 0.12, longlat = TRUE)
data(nypoly)
library(sp)
# plot(nypoly, col = color.clusters(out))
# }
Run the code above in your browser using DataLab