Learn R Programming

DCluster (version 0.2-2)

kn.iscluster: Clustering function for Kulldorff and Nagarwalla's statistic

Description

kn.iscluster is called from opgam when studying the whole area. At every point of the grid, which may be all the centroids, this function is called to determine whether it is a cluster or not by calculating Kulldorff and Nagarwalla's statistic.

See opgam.iscluster.default for more details.

Usage

kn.iscluster(data, idx, idxorder, alpha, fractpop, use.poisson=TRUE, model="poisson", R, mle)

Arguments

data
A dataframe with the data as explained in DCluster.
idx
A boolean vector to know the areas in the current circle.
idxorder
A permutation of the rows of data to order the regions according to their distance to the current center.
alpha
Test signifiance.
fractpop
Maximum fraction of the total population used when creating the balls.
use.poisson
Use the statistic for Poisson (default) or Bernouilli case.
model
Thge model used to generate random observations. It can be 'permutation', 'multinomial', 'poisson' or 'negbin'. See observed.sim manual page for details.
R
The number of bootstrap replicates to generate.
mle
Parameters need by the bootstrap procedure.

Value

  • A vector of four elements, as describe in iscluster manual page.

References

Kulldorff, Martin and Nagarwalla, Neville (1995). Spatial Disease Clusters: Detection and Inference. Statistics in Medicine 14, 799-810.

See Also

DCluster, kullnagar, kullnagar.stat, kullnagar.boot, kullnagar.pboot

Examples

Run this code
library(boot)
library(spdep)

data(nc.sids)

sids<-data.frame(Observed=nc.sids$SID74)
sids<-cbind(sids, Expected=nc.sids$BIR74*sum(nc.sids$SID74)/sum(nc.sids$BIR74))
sids<-cbind(sids, Population=nc.sids$BIR74, x=nc.sids$x, y=nc.sids$y)

#K&N's method over the centroids
mle<-calculate.mle(sids, model="poisson")
knresults<-opgam(data=sids, thegrid=sids[,c("x","y")], alpha=.05, 
	iscluster=kn.iscluster, fractpop=.5, R=100, model="poisson", mle=mle)

#Plot all centroids and significant ones in red
plot(sids$x, sids$y, main="Kulldorff and Nagarwalla's method")
points(knresults$x, knresults$y, col="red", pch=19)

Run the code above in your browser using DataLab