# covTcomb: Covariance matrix for T_k values in 'Tcomb' In nnspat: Nearest Neighbor Methods for Spatial Patterns

 covTcomb R Documentation

## Covariance matrix for T_k values in `Tcomb`

### Description

This function computes the covariance matrix for the T_k values used in the T_{comb} test statistics, which is a linear combination of some T_k tests.

The argument, n_1, is the number of cases (denoted as `n1` as an argument). The number of cases is denoted as n_1 to match the case-control class labeling, which is just the reverse of the labeling in \insertCitecuzick:1990;textualnnspat.

The argument `klist` is the `vector` of integers specifying the indices of the T_k values used in obtaining the T_{comb}.

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.

The logical argument `asy.cov` (default=`FALSE`) is for using the asymptotic covariance or the exact (i.e. finite sample) covariance for the vector of T_k values used in `Tcomb`. If `asy.cov=TRUE`, the asymptotic covariance is used, otherwise the exact covariance is used.

See page 87 of (\insertCitecuzick:1990;textualnnspat) for more details.

### Usage

```covTcomb(dat, n1, klist, nonzero.mat = TRUE, asy.cov = FALSE, ...)
```

### Arguments

 `dat` The data set in one or higher dimensions, each row corresponds to a data point. `n1` Number of cases `klist` `list` of integers specifying the indices of the T_k values used in obtaining the T_{comb}. `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. If `TRUE` the nonzero location matrix is used, otherwise the A matrix itself is used. `asy.cov` A logical argument (default is `FALSE`) to determine whether asymptotic or exact (i.e., finite sample) covariances between T_k and T_l values are to be used to obtain the entries of the covariance matrix. If `TRUE` the asymptotic covariance values are used, otherwise exact covariance values are used. `...` are for further arguments, such as `method` and `p`, passed to the `dist` function.

### Value

Returns the covariance matrix for the T_k values used in `Tcomb`.

Elvan Ceyhan

### References

\insertAllCited

`asycovTkTl`, `covTcomb`, and `Ntkl`

### Examples

```n<-20  #or try sample(1:20,1)
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(0:1,n,replace = TRUE)  #or try cls<-rep(0:1,c(10,10))
n1<-sum(cls==1)

kl<-sample(1:5,3) #try also sample(1:5,2)
kl
covTcomb(Y,n1,kl)
covTcomb(Y,n1,kl,method="max")
covTcomb(Y,n1,kl,nonzero.mat = FALSE)

covTcomb(Y,n1,kl,asy=TRUE)

```

nnspat documentation built on Aug. 30, 2022, 9:06 a.m.