An object of class "htest" performing a \(z\)-test for Cuzick and Edwards \(T_k\) test statistic based on the
number of cases within kNNs of the cases in the data.
For disease clustering, cuzick:1990;textualnnspat suggested a k-NN test \(T_k\) based on number of cases
among k NNs of the case points.
Under RL of \(n_1\) cases and \(n_0\) controls to the given locations in the study region,
\(T_k\) approximately has \(N(E[T_k],Var[T_k]/n_1)\) distribution for large \(n_1\).
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).
Thus, the \(z\)-test for \(T_k\) is same as the cell-specific \(z\)-test for cell \((1,1)\) in the NNCT (see
cell.spec).
The logical argument nonzero.mat (default=TRUE) is for using the \(A\) matrix if FALSE or just the matrix of nonzero
locations in the \(A\) matrix (if TRUE) in the computations.
The logical argument asy.var (default=FALSE) is for using the asymptotic variance or the exact (i.e., finite
sample) variance for the variance of \(T_k\) in its standardization.
If asy.var=TRUE, the asymptotic variance is used for \(Var[T_k]\) (see asyvarTk), otherwise the exact
variance (see varTk) is used.
See also (ceyhan:SiM-seg-ind2014,cuzick:1990;textualnnspat) and the references therein.
ZceTk(
dat,
cc.lab,
k,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95,
case.lab = NULL,
nonzero.mat = TRUE,
asy.var = FALSE,
...
)A list with the elements
The \(Z\) test statistic for the Cuzick and Edwards \(T_k\) test
The \(p\)-value for the hypothesis test for the corresponding alternative
Confidence interval for the Cuzick and Edwards \(T_k\) value
at the given confidence level conf.level and depends on the type of alternative.
Estimate of the parameter, i.e., the Cuzick and Edwards \(T_k\) value.
Hypothesized null value for the Cuzick and Edwards \(T_k\) value which is \(k n_1 (n_1-1)/(n-1)\) for this function.
Type of the alternative hypothesis in the test, one of "two.sided", "less", "greater"
Description of the hypothesis test
Name of the data set, dat
The data set in one or higher dimensions, each row corresponds to a data point.
Case-control labels, 1 for case, 0 for control
Integer specifying the number of NNs (of subject \(i\)).
Type of the alternative hypothesis in the test, one of "two.sided", "less" or "greater".
Level of the upper and lower confidence limits, default is 0.95,
for Cuzick and Edwards \(T_k\) statistic
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
A logical argument (default is TRUE) to determine whether the \(A\) matrix or the matrix of
nonzero locations of the \(A\) matrix will be used in the computation of \(N_s\) and \(N_t\) (argument is passed on to
asyvarTk). If TRUE the nonzero location matrix is used, otherwise the \(A\) matrix itself is used.
A logical argument (default is FALSE) to determine whether the asymptotic variance or
the exact (i.e., finite sample) variance for the variance of \(T_k\) in its standardization.
If TRUE, the asymptotic variance is used for \(Var[T_k]\), otherwise the exact variance is used.
are for further arguments, such as method and p, passed to the dist function.
Elvan Ceyhan
ceTk, cell.spec, and Xsq.ceTk
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))
k<-1 #try also 2,3, sample(1:5,1)
ZceTk(Y,cls,k)
ZceTk(Y,cls,k,nonzero.mat=FALSE)
ZceTk(Y,cls,k,method="max")
ZceTk(Y,cls+1,k,case.lab = 2,alt="l")
ZceTk(Y,cls,k,asy.var=TRUE,alt="g")
Run the code above in your browser using DataLab