Learn R Programming

scanstatistics (version 1.1.1)

top_clusters: Get the top (non-overlappig) clusters.

Description

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,
  ...
)

Value

A data frame with at most \(k\) rows, with columns

zone, duration, score and possibly MC_pvalue, Gumbel_pvalue

and critical_value.

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.

Examples

Run this code
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)

Run the code above in your browser using DataLab