mst.all  R Documentation 
mst.all
finds the set of connected regions that
maximize the spatial scan statistic (the likelihood ratio
test statistic) from each starting region, subject to
relevant constraints. The function can be used to
construct candidate zones for the dynamic minimum
spanning tree (dmst), early stopping dynamic minimum
spanning tree (edmst), double connected spatial scan test
(dc), and maximum linkage (mlink) spatial scan test.
mst.all(
neighbors,
cases,
pop,
w,
ex,
ty,
max_pop,
type = "maxonly",
nlinks = "one",
early = FALSE,
cl = NULL,
progress = FALSE
)
neighbors 
A list containing the vector of neighbors for each region (in ascending order of distance from the region). The starting region itself is included among the neighbors. 
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. 
ex 
The expected number of cases for each region. The default is calculated under the constant risk hypothesis. 
ty 
The total number of cases in the study area. 
max_pop 
The population upperbound (in total population) for a candidate zone. 
type 
One of 
nlinks 
A character vector. The options are

early 
A logical value indicating whether the
"early" stopping criterion should be used. If

cl 
A cluster object created by 
progress 
A logical value indicating whether a
progress bar should be displayed. The default is

This function is not intended to be used by users directly. Consequently, it prioritizes efficiency over user friendliness.
type
is a character vector indicating what should
be returned by the function. If type = "maxonly"
,
then the maximum test statistic from each starting region
is returned . If type = "pruned"
, the function
returns a list that includes the location ids, test
statistic, total cases, expected cases, and total
population for the zone with the maximum test statistic
for each starting region. If type = "all"
, the
function returns a list of lists that includes the
location ids, test statistic, total cases, expected
cases, and total population for the sequence of candidate
zones associated with each starting region.
If nlinks = "one"
, then a region only needs to be
connected to one other region in the current zone to be
considered for inclusion in the next zone. If
nlinks = "two"
, then the region must be connected
to at least two other regions in the current zone. If
nlinks = "max"
, then only regions with the maximum
number of connections to the current zone are considered
for inclusion in the next zone.
Returns a list of relevant information. See Details.
Joshua French
Assuncao, R.M., Costa, M.A., Tavares, A. and Neto, S.J.F. (2006). Fast detection of arbitrarily shaped disease clusters, Statistics in Medicine, 25, 723742. <doi:10.1002/sim.2411>
Costa, M.A. and Assuncao, R.M. and Kulldorff, M. (2012) Constrained spanning tree algorithms for irregularlyshaped spatial clustering, Computational Statistics & Data Analysis, 56(6), 17711783. <doi:10.1016/j.csda.2011.11.001>
# load data
data(nydf)
data(nyw)
# create relevant data
coords < nydf[, c("longitude", "latitude")]
cases < floor(nydf$cases)
pop < nydf$population
w < nyw
ex < sum(cases) / sum(pop) * pop
ubpop < 0.5
ubd < 0.5
ty < sum(cases) # total number of cases
# intercentroid distances
d < gedist(as.matrix(coords), longlat = TRUE)
# upperbound for population in zone
max_pop < ubpop * sum(pop)
# upperbound for distance between centroids in zone
max_dist < ubd * max(d)
# create list of neighbors for each region
# (inclusive of region itself)
all_neighbors < nndist(d, ubd)
# find the dmst max zone
## Not run:
out < mst.all(all_neighbors, cases, pop, w, ex, ty, max_pop,
type = "maxonly"
)
head(out)
out < mst.all(all_neighbors, cases, pop, w, ex, ty, max_pop,
type = "pruned"
)
head(out)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.