flex_test {smerc} | R Documentation |
Flexibly-shaped Spatial Scan Test
Description
flex_test
performs the flexibly-shaped scan test
of Tango and Takahashi (2005).
Usage
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,
...
)
Arguments
coords |
An |
cases |
The number of cases observed in each region. |
pop |
The population size associated with each region. |
w |
A binary spatial adjacency matrix for the regions. |
k |
An integer indicating the maximum number of regions to inclue in a potential cluster. Default is 10 |
ex |
The expected number of cases for each region. The default is calculated under the constant risk hypothesis. |
type |
The type of scan statistic to compute. The
default is |
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. |
longlat |
The default is |
cl |
A cluster object created by |
lonlat |
Deprecated in favor of |
... |
Not used. |
Details
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).
Value
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:
Author(s)
Joshua French
References
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.
See Also
print.smerc_cluster
,
summary.smerc_cluster
,
plot.smerc_cluster
,
scan.stat
, scan.test
Examples
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
)
# better plotting
if (require("sf", quietly = TRUE)) {
data(nysf)
plot(st_geometry(nysf), col = color.clusters(out))
}