slimknclusters: Remove overlapping clusters

Description Usage Arguments Value Examples

View source: R/knutils.R

Description

This function slims the number of clusters down. The spatial scan statistic is known to detect duplicated clusters. This function aims to reduce the number of clusters by removing duplicated and overlapping clusters.

Usage

1
slimknclusters(d, knresults, minsize = 1)

Arguments

d

Data.frame with data used in the detection of clusters.

knresults

Object returned by function opgam() with the clusters detected.

minsize

Minimum size of cluster (default to 1).

Value

A subset of knresults with non-overlaping clusters of at least minsize size.

Examples

1
2
3
4
data("brainNM_clusters")

nm.cl1.s <- slimknclusters(brainst, nm.cl1)
nm.cl1.s

Example output

Loading required package: parallel
Loading required package: sp
Loading required package: spacetime
Loading required package: DCluster
Loading required package: boot
Loading required package: spdep
Loading required package: spData
To access larger datasets in this package, install the spDataLarge
package with: `install.packages('spDataLarge',
repos='https://nowosad.github.io/drat/', type='source')`
Loading required package: sf
Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
Loading required package: MASS
             x        y size minDateCluster maxDateCluster statistic
0286 -106.3073 35.86930    3     1986-03-20     1988-03-20  6.857035
0291 -107.7498 32.18214   12     1985-03-20     1986-03-20  4.103669
0617 -107.7734 34.87512    1     1987-03-20     1987-03-20  2.138255
0279 -105.4592 33.74524    3     1988-03-20     1988-03-20  2.007058
           pvalue      risk cluster alpha_bonferroni
0286 0.0002128539 0.6487021    TRUE       0.00015625
0291 0.0041721334 0.3008419    TRUE       0.00015625
0617 0.0386426187 0.8981373    TRUE       0.00015625
0279 0.0451208529 0.7512122    TRUE       0.00015625

DClusterm documentation built on Feb. 25, 2020, 5:06 p.m.