Package ‘smerc’
April 20, 2018
Type Package
Title Statistical Methods for Regional Counts
Version 0.4.5
Date 2018-04-18
Author Joshua French
Maintainer Joshua French
Description Implements statistical methods for analyzing the counts of areal data,
with a focus on the detection of spatial clusters and clustering.
License GPL (>= 2)
LazyLoad yes
Imports SpatialTools, fields, parallel, maps, smacpod, spdep,
matrixStats, sp
Suggests testthat, SpatialEpi
RoxygenNote 6.0.1
NeedsCompilation no
Repository CRAN
Date/Publication 2018-04-19 23:47:22 UTC
R topics documented:
bn.test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
casewin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
color.clusters
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
dmst.test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
dmst.zones
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
dweights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
flex.test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
flex.zones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
mlf.test
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14
mlf.zones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
nnpop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
1
2
bn.test
nydf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
nypoly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
nyw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
plot.scan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
plot.tango . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
scan.stat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
scan.test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
scan.zones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
tango.stat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
tango.test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
uls.test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
uls.zones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
Index
32
bn.test
Besag-Newell Test
Description
bn.test implements the Besag-Newell test of Besag and Newell (1991) for finding disease clusters.
Usage
bn.test(coords, cases, pop, cstar, alpha = 0.1, lonlat = FALSE,
noc = TRUE, modified = FALSE)
Arguments
coords
An n × 2 matrix of centroid coordinates for the regions.
cases
The number of cases observed in each region.
pop
The population size associated with each region.
cstar
A non-negative integer indicating the minimum number of cases to include in
each window.
alpha
The significance level to determine whether a cluster is signficant. Default is
0.10.
lonlat
The default is
FALSE, which specifies that Euclidean distance should be used.If
lonlat is TRUE, then the great circle distance is used to calculate the inter-
centroid distance.
noc
A logical value indicating whether all significant clusters should be returned
(
FALSE) or only the non-overlapping clusters (TRUE) arranged in order of signif-
icance. The default is
TRUE.
modified
A logical value indicating whether a modified version of the test should be per-
formed. The original paper recommends computing the p-value for each cluster
as
1 - ppois(cstar - 1, lambda = expected). The modified version re-
places
cstar with cases, the observed number of cases in the region, and com-
putes the p-value for the cluster as
1 - ppois(cases - 1, lambda = ex).
The default is
modified = FALSE.
bn.test
3
Value
Returns a list of length two of class
scan. The first element (clusters) is a list containing the
significant clusters and has the the following components:
locids
The location ids of regions in a significant cluster.
coords
The centroid of the initial region.
r
The maximum radius of the cluster (in terms of intercentroid distance from the
starting region).
pop
The total population in the cluser window.
cases
The observed number of cases in the cluster window.
expected
The expected number of cases in the cluster window.
smr
Standarized mortaility ratio (observed/expected) in the cluster window.
rr
Relative risk in the cluster window.
tstat
The loglikelihood ratio for the cluster window (i.e., the log of the test statistic).
pvalue
The pvalue of the test statistic associated with the cluster window.
w
The adjacency matrix of the cluster.
The second element of the list is the centroid coordinates. This is needed for plotting purposes.
Author(s)
Joshua French
References
Besag, J. and Newell, J. (1991). The detection of clusters in rare diseases, Journal of the Royal
Statistical Society, Series A, 154, 327-333.
See Also
scan.stat
,
plot.scan
,
scan.test
,
flex.test
,
dmst.test
,
uls.test
,
mlf.test
Examples
data(nydf)
data(nyw)
coords = with(nydf, cbind(x, y))
out = bn.test(coords = coords, cases = nydf$cases,
pop = nydf$pop, cstar = 6,
alpha = 0.1)
plot(out)
data(nypoly)
library(sp)
plot(nypoly, col = color.clusters(out))