ceTrun {nnspat}R Documentation

Cuzick and Edwards T_{run} Test statistic

Description

This function computes Cuzick and Edwards T_{run} test statistic based on the sum of the number of successive cases from each cases until a control is encountered in the data for detecting rare large clusters.

T_{run} test statistic is defined as T_{run}=\sum_{i=1}^n \delta_i d_i^r where \delta_i=1 if z_i is a case, and 0 if z_i is a control and d_i^r is the number successive cases encountered beginning at z_i until a control is encountered.

The argument cc.lab is case-control label, 1 for case, 0 for control, if the argument case.lab is NULL, then cc.lab should be provided in this fashion, if case.lab is provided, the labels are converted to 0's and 1's accordingly.

See also (Cuzick and Edwards (1990)) and the references therein.

Usage

ceTrun(dat, cc.lab, case.lab = NULL, ...)

Arguments

dat

The data set in one or higher dimensions, each row corresponds to a data point.

cc.lab

Case-control labels, 1 for case, 0 for control

case.lab

The label used for cases in the cc.lab (if cc.lab is not provided then the labels are converted such that cases are 1 and controls are 0), default is NULL.

...

are for further arguments, such as method and p, passed to the dist function.

Value

A list with two elements

Trun

Cuzick and Edwards T_{run} test statistic for disease clustering

run.vec

The vector of number of consecutive cases till the first control for each point in the data set

Author(s)

Elvan Ceyhan

References

Cuzick J, Edwards R (1990). “Spatial clustering for inhomogeneous populations (with discussion).” Journal of the Royal Statistical Society, Series B, 52, 73-104.

See Also

ceTk, Tcomb and ceTkinv

Examples

n<-20  #or try sample(1:20,1)
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(0:1,n,replace = TRUE)  #or try cls<-rep(0:1,c(10,10))

ceTrun(Y,cls)
ceTrun(Y,cls,method="max")
ceTrun(Y,cls+1,case.lab = 2)

#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
ceTrun(Y,fcls,case.lab="a") #try also ceTrun(Y,fcls)

#############
n<-40
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(1:4,n,replace = TRUE)  #here ceTrun(Y,cls) #gives an error message


[Package nnspat version 0.1.2 Index]