Last chance! 50% off unlimited learning
Sale ends in
Two functions: VarTk
and VarTkaij
.
Both functions compute the (finite sample) variance of Cuzick and Edwards k
NNs of the cases in the data under RL or CSR independence.
The common arguments for both functions are n1
, representing the number of cases and k
.
The number of cases are denoted as
The logical argument nonzero.mat
(default=TRUE
) is for using the FALSE
or just the matrix of nonzero
locations in the TRUE
) for computing k
NN relation is symmetric)
and k
NNs of k
NNs of
The function VarTkaij
uses Toshiro Tango's moments formulas based on the VarTk
, see tango:2007;textualnnspat,
where k
NNs of
The function varTkaij
is equivalent to varTk
(with $var
extension).
See (cuzick:1990,tango:2007;textualnnspat).
varTk(dat, n1, k, nonzero.mat = TRUE, ...)varTkaij(n1, k, a)
The function VarTk
returns a list
with the elements
The (finite sample) variance of Cuzick and Edwards
The k
NN relation is symmetric,
see the description.
The k
NNs of k
NNs of
The function VarTkaij
returns only var.Tk
as above.
The data set in one or higher dimensions, each row corresponds to a data point, used in VarTk
only.
Number of cases
Integer specifying the number of NNs (of subject
A logical argument (default is TRUE
) to determine whether the TRUE
the nonzero location matrix is used, otherwise the VarTk
only.
are for further arguments, such as method
and p
, passed to the dist
function. Used in VarTk
only.
The VarTkaij
only.
Elvan Ceyhan
asyvarTk
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<-2 #try also 2,3
a<-aij.mat(Y,k)
varTk(Y,n1,k)
varTk(Y,n1,k,nonzero.mat=FALSE)
varTk(Y,n1,k,method="max")
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, sample(1:5,1)
a<-aij.mat(Y,k)
varTkaij(n1,k,a)
varTk(Y,n1,k)$var
Run the code above in your browser using DataLab