Skip to contents

Get the top \(k\) space-time clusters according to the statistic calculated for each cluster (the maximum being the scan statistic). The default is to return the spatially non-overlapping clusters, i.e. those that do not have any locations in common.

Usage

top_clusters(
  x,
  zones,
  k = 5,
  overlapping = FALSE,
  gumbel = FALSE,
  alpha = NULL,
  ...
)

Arguments

x

An object of class scanstatistics.

zones

A list of integer vectors.

k

An integer, the number of clusters to return.

overlapping

Logical; should the top clusters be allowed to overlap in the spatial dimension? The default is FALSE.

gumbel

Logical; should a Gumbel P-value be calculated? The default is FALSE.

alpha

A significance level, which if not NULL will be used to calculate a critical value for the statistics in the table.

...

Parameters passed to quantile.

Value

A data frame with at most \(k\) rows, with columns zone, duration, score and possibly MC_pvalue, Gumbel_pvalue and critical_value.

Examples

if (FALSE) {
set.seed(1)
counts <- matrix(rpois(15, 3), 3, 5)
zones <- list(1:2, 1:3, 2:5, c(1, 3), 4:5, c(1, 5))
scanres <- scan_permutation(counts, zones, n_mcsim = 5)
top_clusters(scanres, zones, k = 4, overlapping = FALSE)
}