View source: R/whittermore.boot.R
whittermore.boot | R Documentation |
Generate bootstrap replicates of Whittermore's statistic by means of function boot from boot library. Notice that these functions should not be used separately but as argument statistic when calling function boot.
whittermore.boot is used to perform a non-parametric bootstrap
whittermore.pboot is used when using parametric bootstrap.
whittermore.boot(data, i, ...)
whittermore.pboot(...)
data |
A dataframe with the data as explained in DCluster. |
i |
Permutation generated by the non-parametric bootstrap procedure. |
... |
Additional arguments passed when performing a bootstrap. |
Both functions return the value of the statistic.
Whittermore, A. S. and Friend, N. and Byron, W. and Brown, J. R. and Holly, E. A. (1987). A test to detect clusters of disease. Biometrika 74, 631-635.
DCluster, boot, whittermore, whittermore.stat
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, 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.whitt<-nb2listw(dlist, glist=dlist.d, style="C")
niter<-100
#Permutation model
wt.boot<-boot(sids, statistic=whittermore.boot, R=niter, listw=col.W.whitt,
zero.policy=TRUE)
plot(wt.boot)#Display results
#Multinomial model
wt.mboot<-boot(sids, statistic=whittermore.pboot, sim="parametric",
ran.gen=multinom.sim, R=niter, listw=col.W.whitt, zero.policy=TRUE)
plot(wt.mboot)#Display results
#Poisson model
wt.pboot<-boot(sids, statistic=whittermore.pboot, sim="parametric",
ran.gen=poisson.sim, R=niter, listw=col.W.whitt, zero.policy=TRUE)
plot(wt.pboot)#Display results
#Poisson-Gamma model
wt.pgboot<-boot(sids, statistic=whittermore.pboot, sim="parametric",
ran.gen=negbin.sim, R=niter, listw=col.W.whitt, zero.policy=TRUE)
plot(wt.pgboot)#Display results
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.