Title: | Flexible Scan Statistics |
---|---|
Description: | An easy way to conduct flexible scan. Monte-Carlo method is used to test the spatial clusters given the cases, population, and shapefile. A table with formal style and a map with clusters are included in the result report. The method can be referenced at: Toshiro Tango and Kunihiko Takahashi (2005) <doi:10.1186/1476-072X-4-11>. |
Authors: | Zhicheng Du, Yuantao Hao |
Maintainer: | Zhicheng Du <[email protected]> |
License: | GPL-3 |
Version: | 0.2.2 |
Built: | 2024-11-17 05:10:36 UTC |
Source: | https://github.com/cran/FlexScan |
An easy way to conduct flexible scan. Monte-Carlo method is used to test the spatial clusters given the cases, population, and shapefile. A table with formal style and a map with clusters are included in the result report. The method can be referenced at: Toshiro Tango and Kunihiko Takahashi (2005) <doi:10.1186/1476-072X-4-11>.
flexscan(map,case,pop,nsim,k,alpha,isplot,col)
flexscan(map,case,pop,nsim,k,alpha,isplot,col)
map |
spatial object, typically a shapefile read in using 'rgdal::readOGR' |
case |
numeric, a vector of number of cases for each region of 'map'; it is noteworthy that the order of regions in 'case' is corresponding to that in 'map' |
pop |
numeric, a vector of number of population for each region of 'map'; it is noteworthy that the order of regions in 'pop' is corresponding to that in 'map' |
nsim |
numeric, the number of simulations for Monte Carlo test; the default is 999 |
k |
numeric, the maximum number of regions allowed for clusters; the default is 10 |
alpha |
numeric, the significance level of flexible scan test; the default is 0.05 |
isplot |
logical, wether to plot the results; the default is 0.05 |
col |
color vector, two colors for most likely cluster and secondary cluster; the default is c("red","blue") |
data.frame |
a data.frame containing 8 variables as follows: |
Cluster Type |
most likely cluster or secondary cluster |
Region ID |
region id for each cluster; it is noteworthy that the 'ID' is the order of regions in 'map' |
Observed Cases |
observed cases for each cluster |
Expected Cases |
expected cases for each cluster |
SR |
standardized ratio of observed to expected cases |
RR |
relative risk for each cluster |
LLR |
loglikelihood ratio for each cluster |
P Value |
p value of likelihood ratio test for each cluster |
Please feel free to contact us, if you have any advice and find any bug!
Reference:
Tango, T. & Takahashi, K. A Flexibly Shaped Spatial Scan Statistic for Detecting Clusters. INT J HEALTH GEOGR. 4, 11 (2005).
Updates:
Version 0.2.0: Fix the bugs according to the dependent package of "smerc" version 1.1
Version 0.2.2: Fix the bugs according to the dependent package of "spdep"
Zhicheng Du<[email protected]>, Yuantao Hao<[email protected]>
data(map) data(sample) # simple example for checks; turn the warnings back on using 'options(warn=0)' options(warn=-1) flexscan(map,case=sample$case,pop=sample$pop,k=3,isplot=FALSE,nsim=10) ## Not run: flexscan(map,case=sample$case,pop=sample$pop) ## End(Not run)
data(map) data(sample) # simple example for checks; turn the warnings back on using 'options(warn=0)' options(warn=-1) flexscan(map,case=sample$case,pop=sample$pop,k=3,isplot=FALSE,nsim=10) ## Not run: flexscan(map,case=sample$case,pop=sample$pop) ## End(Not run)
There are two variables in the 'sample' including 'case' and 'pop'.
sample
sample