bn.iscluster: Clustering Function for Besag and Newell's Method

Description Usage Arguments Value References See Also Examples

View source: R/besagnewell.stat.R

Description

This function is used to calculate the significance of the agregation of cases around the current area when scanning the whole area by means of function opgam.

When data sampling distribution is multinomial or poisson the exact p-value is computed. In the other cases (i.e., permutation and negative binomial) it is aproximated by bootstrap.

This function must be passed to function opgam as argument iscluster.

Usage

1
bn.iscluster(data, idx, idxorder, alpha, k, model="poisson", R=999, 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 centre.

alpha

Test significance.

k

Size of the cluster.

model

Thge model used to generate random observations. It can be 'permutation', 'multinomial', 'poisson' or 'negbin'.

R

Number of bootstrap replicates made to compute pvalue if the local test.

mle

Parameters needed to compute the Negative Binomial distribution (if used). See negbin.sim manual page for details.

Value

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

References

Besag, J. and Newell, J.(1991). The detection of clusters in rare diseases. Journal of the Royal Statistical Society A 154, 143-155.

See Also

DCluster, besagnewell, besagnewell.boot, besagnewell.pboot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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)

#B&N's method
bnresults<-opgam(data=sids, thegrid=sids[,c("x","y")], alpha=.05, 
	iscluster=bn.iscluster, k=20, R=100, model="poisson", 
	mle=calculate.mle(sids))

#Plot all centroids and significant ones in red
plot(sids$x, sids$y, main="Besag & Newell's method")
points(bnresults$x, bnresults$y, col="red", pch=19)

Example output

Loading required package: boot
Loading required package: spdep
Loading required package: sp
Loading required package: Matrix
Loading required package: MASS

DCluster documentation built on May 2, 2019, 6:10 p.m.