rflex_zones | R Documentation |
rflex_zones
determines the unique zones to
consider for the flexibly shaped spatial scan test of
Tango and Takahashi (2012). The algorithm uses a
breadth-first search to find all subgraphs connected to
each vertex (region) in the data set of size k
or
less with the constraint that the middle p-value of each
region must be less than alpha1
.
rflex_zones(
nn,
w,
cases,
ex,
alpha1 = 0.2,
type = "poisson",
pop = NULL,
cl = NULL,
loop = FALSE,
verbose = FALSE,
pfreq = 1
)
nn |
An n by k matrix providing the k nearest
neighbors of each region, presumably produced by the
|
w |
A binary spatial adjacency matrix for the regions. |
cases |
The number of cases observed in each region. |
ex |
The expected number of cases for each region. The default is calculated under the constant risk hypothesis. |
alpha1 |
The middle p-value threshold. |
type |
The type of scan statistic to compute. The
default is |
pop |
The population size associated with each
region. The default is |
cl |
A cluster object created by |
loop |
A logical value indicating whether a loop
should be used to implement the function instead of
|
verbose |
A logical value indicating whether
progress messages should be provided.
The default is |
pfreq |
The frequency that messages are reported
from the loop (if |
Returns a list of zones to consider for clustering. Each element of the list contains a vector with the location ids of the regions in that zone.
Joshua French
Tango, T. and Takahashi, K. (2012), A flexible spatial scan statistic with a restricted likelihood ratio for detecting disease clusters. Statist. Med., 31: 4207-4218. <doi:10.1002/sim.5478>
rflex.midp
data(nydf)
data(nyw)
coords <- cbind(nydf$x, nydf$y)
nn <- knn(coords, k = 5)
cases <- floor(nydf$cases)
pop <- nydf$pop
ex <- pop * sum(cases) / sum(pop)
# zones for poisson model
pzones <- rflex_zones(nn, w = nyw, cases = cases, ex = ex)
## Not run:
pzones <- rflex_zones(nn,
w = nyw, cases = cases,
ex = ex, verbose = TRUE
)
# zones for binomial model
bzones <- rflex_zones(nn,
w = nyw, cases = cases, ex = ex,
type = "binomial", pop = pop
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.