# NOT RUN {
# load sample data (North Carolina SIDS data)
library(spdep)
data("nc.sids")
# calculate the expected numbers of cases
expected <- nc.sids$BIR74 * sum(nc.sids$SID74) / sum(nc.sids$BIR74)
# run FleXScan
fls <- flexscan(x = nc.sids$x, y = nc.sids$y,
observed = nc.sids$SID74,
expected = expected,
name = rownames(nc.sids),
clustersize = 10,
nb = ncCR85.nb)
# display all clusters
plot(fls)
# display clusters with rank 1, 2 and 3
plot(fls, rank = c(1, 2, 3))
# display clusters of P-value <= 0.05
plot(fls, pval = 0.05)
# }
Run the code above in your browser using DataLab