funsAijmat {nnspat}R Documentation

Aij matrices for computation of Moments of Cuzick and Edwards T_k Test statistic

Description

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 kNNs of z_i and 0 otherwise due to Tango (2007). 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 (Tango (2007)).

Usage

aij.mat(dat, k, ...)

aij.nonzero(dat, k, ...)

Arguments

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 i), default is 1.

...

are for further arguments, such as method and p, passed to the dist function.

Value

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

Author(s)

Elvan Ceyhan

References

Tango T (2007). “A class of multiplicity adjusted tests for spatial clustering based on case-control point data.” Biometrics, 63, 119-127.

See Also

aij.theta and EV.Tkaij

Examples

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")


[Package nnspat version 0.1.2 Index]