| asyvarTk {nnspat} | R Documentation |
Asymptotic Variance of Cuzick and Edwards T_k Test statistic
Description
This function computes the asymptotic variance of Cuzick and Edwards T_k test statistic based on the number
of cases within kNNs of the cases in the data.
The argument, n_1, is the number of cases (denoted as n1 as an argument).
The number of cases are denoted as n_1 and number of controls as n_0 in this function
to match the case-control class labeling,
which is just the reverse of the labeling in Cuzick and Edwards (1990).
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) for computing N_s and N_t, which are required in the computation of the
asymptotic variance. N_s and N_t are defined on page 78 of (Cuzick and Edwards (1990)) as follows.
N_s=\sum_i\sum_j a_{ij} a_{ji} (i.e., number of ordered pairs for which kNN relation is symmetric)
and N_t= \sum \sum_{i \ne l}\sum a_{ij} a_{lj} (i.e, number of triplets (i,j,l) i,j, and l distinct so that
j is among kNNs of i and j is among kNNs of l).
For the A matrix, see the description of the functions aij.mat and aij.nonzero.
See (Cuzick and Edwards (1990)) for more details.
Usage
asyvarTk(dat, n1, k, nonzero.mat = TRUE, ...)
Arguments
dat |
The data set in one or higher dimensions, each row corresponds to a data point. |
n1 |
Number of cases |
k |
Integer specifying the number of NNs (of subject |
nonzero.mat |
A logical argument (default is |
... |
are for further arguments, such as |
Value
A list with the elements
asy.var |
The asymptotic variance of Cuzick and Edwards |
Ns |
The |
Nt |
The |
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
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))
n1<-sum(cls==1)
k<-3 #try also 2,3
asyvarTk(Y,n1,k)
asyvarTk(Y,n1,k,nonzero.mat=FALSE)
asyvarTk(Y,n1,k,method="max")