ceTkinv: Cuzick and Edwards T_k^{inv} Test statistic

ceTkinvR Documentation

Cuzick and Edwards T_k^{inv} Test statistic

Description

This function computes Cuzick and Edwards T_k^{inv} test statistic based on the sum of number of cases closer to each case than the k-th nearest control to the case.

T_k^{inv} test statistic is an extension of the run length test allowing a fixed number of controls in the run sequence.

T_k^{inv} test statistic is defined as T_k^{inv}=\sum_{i=1}^n \delta_i \nu_i^k where \delta_i=1 if z_i is a case, and 0 if z_i is a control and \nu_i^k is the number of cases closer to the index case than the k nearest control, i.e., number of cases encountered beginning at z_i until k-th 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.

Usage

ceTkinv(dat, k, cc.lab, case.lab = NULL, ...)

Arguments

dat

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

k

Integer specifying the number of the closest controls to subject i.

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

Tkinv

Cuzick and Edwards T_k^{inv} test statistic for disease clustering

run.vec

The vector of number of cases till the k-th control for each point in the data set

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

ceTrun, ceTk, and Tcomb

Examples

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

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

ceTrun(Y,cls)
ceTkinv(Y,k=1,cls)

#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
ceTkinv(Y,k,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 ceTkinv(Y,k,cls) #gives error


nnspat documentation built on May 29, 2024, 10:03 a.m.