Learn R Programming

nnspat (version 0.1.2)

asycovTkTl: Asymptotic Covariance between \(T_k\) and \(T_l\) Values

Description

This function computes the asymptotic covariance between \(T_k\) and \(T_l\) values which is used in the computation of the asymptotic variance of Cuzick and Edwards \(T_{comb}\) test, which is a linear combination of some \(T_k\) tests. The limit is as \(n_1\) goes to infinity.

The argument, \(n_1\), is the number of cases (denoted as n1 as an argument). The number of cases are denoted as \(n_1\) and number of controls as \(n_0\) in this function to match the case-control class labeling, which is just the reverse of the labeling in cuzick:1990;textualnnspat.

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 page 80 of (cuzick:1990;textualnnspat) for more details.

Usage

asycovTkTl(dat, n1, k, l, nonzero.mat = TRUE, ...)

Value

Returns the asymptotic covariance between \(T_k\) and \(T_l\) values.

Arguments

dat

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

n1

Number of cases

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

covTkTl, covTcomb, and Ntkl

Examples

Run this code
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)

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)

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

Run the code above in your browser using DataLab