tango.stat {DCluster} | R Documentation |
Compute Tango's statistic for general clustering. See tango manual page for details.
tango.stat(data, listw, zero.policy)
data |
Dataframe with the data as described in DCluster. |
listw |
Neighbours list with spatial weights created, for example, by 'nb2listw' (package spdep). |
zero.policy |
See nb2listw in package spdep. |
Tango, Toshiro (1995). A Class of Tests for Detecting 'General' and 'Focused' Clustering of Rare Diseases. Statistics in Medicine 14, 2323-2334.
DCluster, tango, tango.boot, tango.pboot
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, x=nc.sids$x, y=nc.sids$y) #Calculate neighbours based on distance coords<-as.matrix(sids[,c("x", "y")]) dlist<-dnearneigh(coords, 0, Inf) dlist<-include.self(dlist) dlist.d<-nbdists(dlist, coords) #Calculate weights. They are globally standardised but it doesn't #change significance. col.W.tango<-nb2listw(dlist, glist=lapply(dlist.d, function(x) {exp(-x)}), style="C") niter<-100 #use exp(-D) as closeness matrix tango.stat(sids, col.W.tango, zero.policy=TRUE)