# ceTk: Cuzick and Edwards T_k Test statistic In nnspat: Nearest Neighbor Methods for Spatial Patterns

 ceTk R Documentation

## Cuzick and Edwards T_k Test statistic

### Description

This function computes Cuzick and Edwards T_k test statistic based on the number of cases within `k`NNs of the cases in the data.

For disease clustering, \insertCitecuzick:1990;textualnnspat suggested a `k`-NN test based on number of cases among `k` NNs of the case points. Let z_i be the i^{th} point and d_i^k be the number cases among `k` NNs of z_i. Then Cuzick-Edwards' `k`-NN test is T_k=∑_{i=1}^n δ_i d_i^k, where δ_i=1 if z_i is a case, and 0 if z_i is a control.

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. Also, T_1 is identical to the count for cell (1,1) in the nearest neighbor contingency table (NNCT) (See the function `nnct` for more detail on NNCTs).

### Usage

```ceTk(dat, cc.lab, k = 1, 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 `k` Integer specifying the number of NNs (of subject i), default is `1`. `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

Cuzick and Edwards T_k test statistic for disease clustering

Elvan Ceyhan

### References

\insertAllCited

`Tcomb`, `seg.ind`, `Pseg.coeff` 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))

ceTk(Y,cls)
ceTk(Y,cls,method="max")
ceTk(Y,cls,k=3)
ceTk(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))
ceTk(Y,fcls,case.lab="a") #try also ceTk(Y,fcls)

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

```

nnspat documentation built on Aug. 30, 2022, 9:06 a.m.