| funsAijmat | R Documentation |
T_k Test statisticTwo functions: aij.mat and aij.nonzero.
The function aij.mat yields the A=(a_{ij}(k)) matrix where a_{ij}(k) = 1 if z_j is among the kNNs of z_i
and 0 otherwise due to \insertCitetango:2007;textualnnspat.
This matrix is useful in calculation of the moments of Cuzick-Edwards T_k tests.
The function aij.nonzero keeps only nonzero entries, i.e., row and column entries where
in each row, for the entry (r_1,c_1) r_1 is the row entry and c_1 is the column entry. Rows are from
1 to n, which stands for the data point or observation, and column entries are from 1 to k, where k is specifying
the number of kNNs (of each observation) considered. This function saves in storage memory, but needs to be
carefully unfolded in the functions to represent the actual the A matrix.
See also (\insertCitetango:2007;textualnnspat).
aij.mat(dat, k, ...)
aij.nonzero(dat, k, ...)
dat |
The data set in one or higher dimensions, each row corresponds to a data point. |
k |
Integer specifying the number of NNs (of subject |
... |
are for further arguments, such as |
The function aij.mat returns the A_{ij} matrix for computation of moments of Cuzick and Edwards T_k
Test statistic while the function aij.nonzero returns the (locations of the) non-zero entries in the A_{ij}
matrix
Elvan Ceyhan
aij.theta and EV.Tkaij
n<-20 #or try sample(1:20,1)
Y<-matrix(runif(3*n),ncol=3)
k<-3 #try also 2,3
Aij<-aij.mat(Y,k)
Aij
Aij2<-aij.mat(Y,k,method="max")
range(Aij,Aij2)
apply(Aij,2,sum) #row sums of Aij
aij.nonzero(Y,k)
aij.nonzero(Y,k,method="max")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.