bn.test: Besag-Newell Test

View source: R/bn.test.R

bn.testR Documentation

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,
  ex = sum(cases)/sum(pop) * pop,
  alpha = 0.1,
  longlat = FALSE,
  modified = FALSE
)

Arguments

coords

An n \times 2 matrix of centroid coordinates for the regions in the form (x, y) or (longitude, latitude) is using great circle distance.

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.

ex

The expected number of cases for each region. The default is calculated under the constant risk hypothesis.

alpha

The significance level to determine whether a cluster is signficant. Default is 0.10.

longlat

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.

modified

A logical value indicating whether a modified version of the test should be performed. The original paper recommends computing the p-value for each cluster as 1 - ppois(cstar - 1, lambda = expected). The modified version replaces cstar with cases, the observed number of cases in the region, and computes the p-value for the cluster as 1 - ppois(cases - 1, lambda = ex). The default is modified = FALSE.

Value

Returns a smerc_cluster object.

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

print.smerc_cluster, summary.smerc_cluster, plot.smerc_cluster, scan.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)

# better plotting
if (require("sf", quietly = TRUE)) {
   data(nysf)
   plot(st_geometry(nysf), col = color.clusters(out))
}

jpfrench81/smerc documentation built on Jan. 13, 2024, 4:30 a.m.