Learn R Programming

nnspat (version 0.1.2)

Ntkl: \(N_{tkl}\) Value

Description

This function computes the \(N_{tkl}\) value which is required in the computation of the exact and asymptotic variance of Cuzick and Edwards \(T_{comb}\) test, which is a linear combination of some \(T_k\) tests. \(N_{tkl}\) is defined on page 80 of (cuzick:1990;textualnnspat) as follows. Let \(a_{ij}(k)\) be 1 if \(j\) is a k NN of \(i\) and zero otherwise and \(N_t(k,l) = \sum \sum_{i \ne m}\sum a_{ij}(k) a_{mj}(l)\).

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) in the computations.

See (cuzick:1990;textualnnspat) for more details.

Usage

Ntkl(dat, k, l, nonzero.mat = TRUE, ...)

Value

Returns the \(N_{tkl}\) value. See the description.

Arguments

dat

The data set in one or higher dimensions, each row corresponds to a data point.

k, l

Integers specifying the number of NNs (of subjects \(i\) and \(m\) in \(a_{ij}(k) a_{mj}(l)\)).

nonzero.mat

A logical argument (default is TRUE) to determine whether the \(A\) matrix or the matrix of nonzero locations of the \(A\) matrix will be used in the computation of \(N_s\) and \(N_t\) (argument is passed on to asycovTkTl and covTkTl). If TRUE the nonzero location matrix is used, otherwise the \(A\) matrix itself is used.

...

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

Author

Elvan Ceyhan

References

See Also

asycovTkTl, and covTkTl

Examples

Run this code
n<-20  #or try sample(1:20,1)
Y<-matrix(runif(3*n),ncol=3)
k<-1 #try also 2,3 or sample(1:5,1)
l<-1 #try also 2,3 or sample(1:5,1)
c(k,l)

Ntkl(Y,k,l)
Ntkl(Y,k,l,nonzero.mat = FALSE)
Ntkl(Y,k,l,method="max")

Run the code above in your browser using DataLab