Two 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 k
NNs of \(z_i\)
and 0 otherwise due to tango: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 k
NNs (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 (tango:2007;textualnnspat).