funsAijmat: Aij matrices for computation of Moments of Cuzick and Edwards...

funsAijmatR 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 \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).

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

\insertAllCited

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


nnspat documentation built on May 29, 2024, 10:03 a.m.