multiflexscan

Analyze spatial count data for detecting multiple disease clusters using the information criterion and scan statistic approach developed by Takahashi and Shimadzu (2018, 2020). The package builds on rflexscan for candidate cluster generation and adds information-criterion-based selection of the number of clusters and a global Monte Carlo test.

Install

install.packages("multiflexscan")

Development version from GitHub:

install.packages("devtools")
# devtools::install_github("tkhrotn/multiflexscan")
install.packages("multiflexscan", repos = c('https://tkhrotn.r-universe.dev', 'https://cloud.r-project.org'))

Basic usage

library(multiflexscan)

fit <- multiflexscan(
  x = x, y = y, name = area_id,
  observed = observed, expected = expected,
  nb = neighbors,
  scanmethod = "FLEXIBLE",
  stattype = "RESTRICTED",
  clustertype = "HOT",
  clustersize = 10,
  maxclusters = 10,
  ralpha = 0.2,
  simcount = 999,
  cores = 2
)

print(fit)
summary(fit)
plot(fit)

multiflexscan() returns the candidate clusters generated by rflexscan, the information-criterion values used to select the number of clusters, and a Monte Carlo p-value for the selected cluster set. If an sf object containing the same regions is available, selected clusters can be mapped with:

choropleth(fit, regions = regions_sf)

Model diagnostics (0.3.0)

model_criteria(fit)                  # all K, including K = 0
model_criteria(fit, selected = TRUE)  # one selected model
logLik(fit)
-2 * as.numeric(logLik(fit))
AIC(fit)
BIC(fit)
C_criterion(fit)
RDC(fit)

The log-likelihood and ordinary AIC/BIC describe the selected Poisson model conditional on the candidate regions. Selection uses C/RDC, not ordinary AIC/BIC. AIC(fit, k = 3) supports a different penalty; AIC(fit1, fit2) and BIC(fit1, fit2) compare models fitted to the same response data. coef(fit) retains its existing behavior of returning a cluster summary table, not Poisson regression coefficients; use clusters(fit) for clarity.

References

A self-contained workflow is available with vignette("workflow", package = "multiflexscan"). It covers aligned inputs, a seeded analysis, global versus cluster-level p-values, model criteria, plotting, and saved results.