asyvarTk | R Documentation |
This function computes the asymptotic variance of Cuzick and Edwards T_k test statistic based on the number
of cases within k
NNs 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 \insertCitecuzick:1990;textualnnspat.
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 (\insertCitecuzick:1990;textualnnspat) as follows.
N_s=∑_i∑_j a_{ij} a_{ji} (i.e., number of ordered pairs for which k
NN relation is symmetric)
and N_t= ∑ ∑_{i \ne l}∑ a_{ij} a_{lj} (i.e, number of triplets (i,j,l) i,j, and l distinct so that
j is among k
NNs of i and j is among k
NNs of l).
For the A matrix, see the description of the functions aij.mat
and aij.nonzero
.
See (\insertCitecuzick:1990;textualnnspat) for more details.
asyvarTk(dat, n1, k, nonzero.mat = TRUE, ...)
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 i) |
nonzero.mat |
A logical argument (default is |
... |
are for further arguments, such as |
A list
with the elements
asy.var |
The asymptotic variance of Cuzick and Edwards T_k test statistic for disease clustering |
Ns |
The N_s value standing for the number of ordered pairs for which |
Nt |
The N_t value standing for the number of triplets (i,j,l) i,j, and l distinct so that
j is among |
Elvan Ceyhan
ceTk
, varTk
, and varTkaij
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.