# Ntkl: N_{tkl} Value In nnspat: Nearest Neighbor Methods for Spatial Patterns

## 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 (\insertCitecuzick: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) = ∑ ∑_{i \ne m}∑ 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 (\insertCitecuzick:1990;textualnnspat) for more details.

## Usage

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

## 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.

## Value

Returns the N_{tkl} value. See the description.

Elvan Ceyhan

## References

\insertAllCited

`asycovTkTl`, and `covTkTl`
 ```1 2 3 4 5 6 7 8 9``` ```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") ```