##### R-code for Example 7.3 and Figure 7.3 to demonstrate the Scan method ##### You need to install the R package "smerc" before using this R code, ##### by running the R commands: ##### > install.packages("smerc") ##### > library("smerc") pdf("fig73.pdf",width=4,height=4.5) data(nydf) coords = with(nydf, cbind(longitude, latitude)) out = scan.test(coords = coords, cases = floor(nydf$cases), pop = nydf$pop, nsim = 1000, alpha = 0.05, longlat = F) ## plot output for new york state # specify desired argument values mapargs = list(database = "county", region = "new york", xlim = range(out$coords[,1]), ylim = range(out$coords[,2])) # needed for "state" database (unless you execute library(maps)) data(countyMapEnv, package = "maps") plot(out, usemap = TRUE, mapargs = mapargs, idx = 1:2, cex=0.4) #plot(out, usemap = TRUE, mapargs = mapargs) # extract detected clusteers clusters(out) graphics.off()